qnd:sign_powershell_script

Sign Powershell Script

New-Self​Signed​Certificate

PS C:\tmp\Azure> New-SelfSignedCertificate -CertStoreLocation cert:\currentuser\my -Subject "CN=Local Code Signing" -KeyAlgorithm RSA -KeyLength 2048 -Provider "Microsoft Enhanced RSA and AES Cryptographic Provider" -KeyExportPolicy Exportable -KeyUsage DigitalSignature ` -Type CodeSigningCert


   PSParentPath: Microsoft.PowerShell.Security\Certificate::CurrentUser\my

Thumbprint                                Subject
----------                                -------
FBEA9166C4E1429775EB6BDEE47E54E49083811C  CN=Local Code Signing


$cert = @(Get-ChildItem cert:\CurrentUser\My -CodeSigning)[0] 

Set-AuthenticodeSignature .\your-script.ps1 $cert
  • qnd/sign_powershell_script.txt
  • Last modified: 2021/03/10 20:08
  • by mgupton