Created
January 3, 2010 20:43
-
-
Save actaneon/268121 to your computer and use it in GitHub Desktop.
Sign Powershell Script
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
#Enable Signed Scripts | |
#Set-ExecutionPolicy AllSigned | |
#Create Trusted Root CA | |
#makecert -n "CN=PowerShell Local Certificate Root" -a sha1 -eku 1.3.6.1.5.5.7.3.3 -r -sv root.pvk root.cer -ss Root -sr localMachine | |
#Create Personal Cert | |
#makecert -pe -n "CN=PowerShell User" -ss MY -a sha1 -eku 1.3.6.1.5.5.7.3.3 -iv root.pvk -ic root.cer | |
#Sign Script with Personal Cert | |
if ($args.length -ne 1) { | |
write-host "Usage: <filename>" | |
exit | |
} | |
else { | |
$filename = $args[0] | |
Set-AuthenticodeSignature $filename @(Get-ChildItem cert:\CurrentUser\My -codesigning)[0] | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment