Monday, December 12, 2011

How to digitally sign your powershell script

First open up the Certificates snap-in for your user account in MMC
Have a look in your Personal Certificates store to see if you have a Code Signing certificate - if not, import one if you have one from a trusted CA, or request one from the CA on your AD domain ... if a Code Signing certificate is not available you will need to get your CA to publish a Code Signing certificate template.

Once you have a Code signing cert in your Personal store:

PS>$cert=Get-ChildItem -Path cert:\CurrentUser\my -CodeSigningCert
PS>Set-AuthenticodeSignature -FilePath MyScript.ps1 -certificate $cert

No comments:

Post a Comment