Question:
How do I export a self-signed certificate from IIS 7 using PowerShell?
Answer:
1 2 |
dir cert:\localmachine\my | Where-Object { $_.hasPrivateKey } | Foreach-Object { [system.IO.file]::WriteAllBytes("c:\$($_.Subject).pfx", ($_.Export('PFX', 'secret')) ) } |
Source: Exporting Certificate With Private Key
This will export all of your certificates into C:\
.
You can check what certificates you have by running:
1 2 |
dir cert:\localmachine\my |