Last active
February 19, 2021 14:40
-
-
Save thefamousbrian/16aea19b9e2eef6dea55a7db073959ad to your computer and use it in GitHub Desktop.
certutil error checking Powershell DSC Script resource
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Install local cert with certutil | |
Script localcert { | |
SetScript = { | |
$certPath = "C:\Installers\$using:cert" | |
$result = $(certutil -p $using:cert_pass -csp "Microsoft Enhanced RSA and AES Cryptographic Provider" -importpfx $certPath) | |
if($result -like '*FAILED*') { | |
Throw "certutil failed for local cert $certPath $result" | |
} | |
} | |
TestScript = { $false } | |
GetScript = { } | |
} | |
# Install claims cert with certutil | |
Script claimscert { | |
SetScript = { | |
$certPath = "C:\Installers\$using:claims_cert" | |
$result = $(certutil -p $using:claims_cert_pass -csp "Microsoft Enhanced RSA and AES Cryptographic Provider" -importpfx $certPath) | |
if($result -like '*FAILED*') { | |
Throw "certutil failed for claims cert $certPath $result" | |
} | |
} | |
TestScript = { $false } | |
GetScript = { } | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment