-
-
Save anonymous/53265d7a7794093b847f to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$servers = Get-Content 'C:\scripts\servers.txt' | |
$certName = Read-Host -Prompt 'Enter Certificate Name' | |
ForEach($server in $servers) { | |
Copy-Item d:\SSL_Test\Summer\$certName.pfx -Destination \\$server\c$\SSL -force | |
} | |
ForEach($server in $servers) { Invoke-Command $server -ScriptBlock { | |
Function Import-PfxCertificate { | |
param([String]$certPath,[String]$certRootStore = “CurrentUser”,[String]$certStore = “My”,$pfxPass = $null) | |
$pfx = new-object System.Security.Cryptography.X509Certificates.X509Certificate2 | |
if ($pfxPass -eq $null) {$pfxPass = read-host “Enter the pfx password” -assecurestring} | |
$pfx.import($certPath,$pfxPass,“Exportable,PersistKeySet”) | |
$store = new-object System.Security.Cryptography.X509Certificates.X509Store($certStore,$certRootStore) | |
$store.open(“MaxAllowed”) | |
$store.add($pfx) | |
$store.close() | |
} | |
Import-PfxCertificate \\$server\c$\SSL\$certName.pfx "localmachine" "my" | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment