function Import-509Certificate {
param([String]$certPath,[String]$certRootStore,[String]$certStore)
$pfx = new-object System.Security.Cryptography.X509Certificates.X509Certificate2
$pfx.import($certPath)
$store = new-object System.Security.Cryptography.X509Certificates.X509Store($certStore,$certRootStore)
$store.open(“MaxAllowed”)
$store.add($pfx)
$store.close()
}
function Import-PfxCertificate {
param([String]$certPath,[String]$certRootStore = “LocalMachine”,[String]$certStore = “My”,$pfxPass = $null)
$pfx = new-object System.Security.Cryptography.X509Certificates.X509Certificate2
$pfxPass = convertto-securestring "1234" -asplaintext -force
$pfx.import($certPath,$pfxPass,“PersistKeySet”)
$store = new-object System.Security.Cryptography.X509Certificates.X509Store($certStore,$certRootStore)
$store.open(“MaxAllowed”)
$store.add($pfx)
$store.close()
$keyPath = .\FindPrivateKey My LocalMachine -t $pfx.Thumbprint -a
icacls $keyPath /grant "IIS_IUSRS:(R)"
}
$certificatelocationkys = resolve-path .\CER\kys.pfx
$certificatelocationkimlikdogrulama = resolve-path .\CER\mernis.cer
$certificatelocationkale = resolve-path .\CER\kale.cer
Import-PfxCertificate $certificatelocationkys
Import-509Certificate $certificatelocationkimlikdogrulama "LocalMachine" "TrustedPeople"
Import-509Certificate $certificatelocationkale "LocalMachine" "AuthRoot"
No comments:
Post a Comment