Quantcast
Channel: PowerShell.com – PowerShell Scripts, Tips, Forums, and Resources
Viewing all articles
Browse latest Browse all 6937

A question regarding the ADD method of Type System.Security.Cryptography.X509Certificates.X509Store

$
0
0

Hello

Can someone please help me the following qustion please.

using the above class/type I can get an SSL certificate from one computer and add to the x509 store to another computer like so

 

cls
$Store=new-object `
System.Security.Cryptography.X509Certificates.X509Store("\\$ComputerName\My","LocalMachine")
$Store.Open("MaxAllowed")
$Cert1=$Store.Certificates | select -First 1
$Store2=new-object `
System.Security.Cryptography.X509Certificates.X509Store("\\$ComputerName2\My","LocalMachine")
$Store2.Open("MaxAllowed")
$Store2.Add($Cert1)

 The object type expected by the ADD method is "X509Certificate2" which is fine in the above case as this was the type of object retrieved in the first step.

My question is if I have a .cer or .pfx file how can I get this into the above format (if possible) ready for adding to the remote X509 store

Thanks All
Ernie


Viewing all articles
Browse latest Browse all 6937

Trending Articles