MattyS82
asked on
PowerShell Script
Hi,
Running the Get-ChildItem -Recurse Cert: in powershell gives me a list of installed certificates on the server.
My question is. How to I script this to get the certificates installed on several servers? I.e if I have a list of servers I want to query in a text file. Basically, how do I run this command on a list of servers?
Running the Get-ChildItem -Recurse Cert: in powershell gives me a list of installed certificates on the server.
My question is. How to I script this to get the certificates installed on several servers? I.e if I have a list of servers I want to query in a text file. Basically, how do I run this command on a list of servers?
gc serverlist.txt | foreach-object {invoke-command -computername $_ -scriptblock {gci cert:\LocalMachine\My }}
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Subsun,
There is an unresolved reference to $Search in the Write-Host message ;-). But the script works nevertheless.
There is an unresolved reference to $Search in the Write-Host message ;-). But the script works nevertheless.
Ha.. I forgot to remove it. Thanks for checking...I just modified the script which I had done for another question #a38476902.. :-)
@MattyS82, You can modify line 16 to..
else {Write-Host "$server Does not contain any certs" -B Yellow -F Red}
@MattyS82, You can modify line 16 to..
else {Write-Host "$server Does not contain any certs" -B Yellow -F Red}
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Thank you for your efforts. This is greatly appreciated and it was way beyond my knowledge of powershell.