cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
907
Views
5
Helpful
1
Replies

Powershell Script help

naveev
Cisco Employee
Cisco Employee

I have a UCCE environment where there are 8 Windows servers and 4 CUCM servers(Linux) installed on it. I need to export all the certificates from all the 8 Windows servers and 4 CUCM servers.

Code:

dir cert:\localmachine\my | Where-Object { $_.hasPrivateKey } |   Foreach-Object { [system.IO.file]::WriteAllBytes("c:\$($_.Subject).cer",     ($_.Export('CER', 'secret')) ) }

I wasn't able to export a certificate from remote Windows servers, I tried below code:

$Srv = "remoteserver.com"

$Certs = Invoke-Command -Credential $cred -Computername $Srv -Scriptblock {Get-ChildItem "Cert:\LocalMachine\My"}

 

 

1 Reply 1

teamyankee
Level 1
Level 1

Did you get an error message? You prob need local admin rights to pull the certs.  Google 'run as administrator powershell' for script samples.

Getting Started

Find answers to your questions by entering keywords or phrases in the Search bar above. New here? Use these resources to familiarize yourself with the community: