Difference between revisions of "Powershell certs"
Jump to navigation
Jump to search
| (2 intermediate revisions by the same user not shown) | |||
| Line 1: | Line 1: | ||
| + | ``` | ||
| + | $session = New-PSSession -ComputerName $computerName | ||
| + | Copy-Item -Path $CertPath -ToSession $session -Destination 'c:\windows\temp\test.pfx' | ||
| + | |||
| + | Invoke-Command -Session $session -ScriptBlock { | ||
| + | Import-PFXCertificate -CertStoreLocation Cert:\LocalMachine\My -FilePath 'c:\windows\temp\test.pfx' -Password $using:CertPass | ||
| + | } | ||
| + | Remove-PSSession $session | ||
| + | |||
| + | ``` | ||
| + | |||
| + | |||
| + | https://social.technet.microsoft.com/Forums/en-US/2eda9d44-aeb3-47cb-942a-cb41306091ba/import-pfx-certificate-on-remote-computers-with-script?forum=winserverpowershell | ||
| + | |||
| + | |||
https://superuser.com/questions/889149/export-installed-certificate-and-private-key-from-a-command-line-remotely-in-win | https://superuser.com/questions/889149/export-installed-certificate-and-private-key-from-a-command-line-remotely-in-win | ||
| Line 4: | Line 19: | ||
https://www.tutorialspoint.com/how-to-install-a-certificate-to-the-certificate-store-using-powershell | https://www.tutorialspoint.com/how-to-install-a-certificate-to-the-certificate-store-using-powershell | ||
| + | |||
| + | https://stackoverflow.com/questions/21278492/install-certificate-with-powershell-on-remote-server | ||
Latest revision as of 01:44, 28 June 2022
$session = New-PSSession -ComputerName $computerName
Copy-Item -Path $CertPath -ToSession $session -Destination 'c:\windows\temp\test.pfx'
Invoke-Command -Session $session -ScriptBlock {
Import-PFXCertificate -CertStoreLocation Cert:\LocalMachine\My -FilePath 'c:\windows\temp\test.pfx' -Password $using:CertPass
}
Remove-PSSession $session
https://lachlanbarclay.net/2022/01/updating-iis-certificates-with-powershell
https://stackoverflow.com/questions/21278492/install-certificate-with-powershell-on-remote-server