Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- If ((Get-ChildItem -Path "Cert:\LocalMachine\root" | where-Object {$_.subject -like 'CN=PyrotekSACA*'})-eq $Null)
- {
- $unccertpath = ($scriptspath + $CAName+'.cer')
- While ("get-Childitem $unccertpath" -eq $NULL)
- {
- $MyWarning = "SSL Cert does not exist at the provided path $certpath please refer to documentation and ensure cert exists before continuing"
- MSG
- Pause
- }
- $certpath = "C:\Certs\"
- copy $unccertpath $certpath
- $certfile = "$certPath$CAName.cer"
- $certRootStore = “LocalMachine”
- $certStore = "Cert:\LocalMachine\root"
- get-childitem cert:\LocalMachine\root | get-member
- function Import-509Certificate
- {
- param([String]$certfile,[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()
- }
- Import-509Certificate
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement