Powershell to import certificate in store.
Quick go through of adding certificates to Trusted Root Store using powershell.
Code is as follows –
Param
(
[String]$certPath="your certificate path ",
[String]$certRootStore = “CurrentUser”,
[String]$certStore = "root", - this means we are adding certificate to Trusted Root Certification authorities
$pfxPass = "Your password"
)
$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()
Hope this helps.
Cheers…
Happy Coding!!
No comments:
Post a Comment