Import Certificates via PowerShell

If you’re like me I have to play with a lot of labs. I often use the same domain names to make my certificate life a little easier to manage. Maybe you just need to import certificates on a lot of servers. Either case this little snippet will make your certificate life a little easier :-).

      Welcome to the Exchange Management Shell!

VERBOSE: Connecting to Exchange Server.
VERBOSE: Connected to Exchange Server.

[PS] C:\PowerShell>$pfxpath = “C:\Certificates\”
[PS] C:\PowerShell>$password = “MyPasswordIsSecure”
[PS] C:\PowerShell>Add-Type -AssemblyName System.Security
[PS] C:\PowerShell>$cert = New-Object System.Security.Cryptography.X509Certificates.X509Certificate2Collection
[PS] C:\PowerShell>$cert.Import($pfxpath, $password, ‘Exportable’)
[PS] C:\PowerShell>$cert