Skip to content

tylerapplebaum/powershell-codesigning

powershell-codesigning

New-CodeSigningCert.ps1

Note: This script uses the New-SelfSignedCertificate cmdlet, which is only available in Windows 10 / Server 2016 and newer. The cmdlet itself is present in older versions, but it does not have the same functionality.

2012R2 Docs

2016 Docs

Usage:

Import-Module .\New-CodeSigningCert.psm1
New-CodeSigningCert -Subject "Your Own Code Signing Cert" -EMail "e@mail.com" -PFXPassword "1234" -FriendlyName "PSCodeSigningTest" -CertValidYears 5

New-CodeSigningCert requires an Adminstrator shell in order to import the certificate into the LocalMachine root store.

Invoke-BinarySignature.psm1

Usage:

Tab complete the -CertFriendlyName parameter to list all code signing certificates in your user store.

Import-Module Invoke-BinarySignature.psm1
New-BinarySignature -CertFriendlyName "PSCodeSigningTest" -BinPath "C:\Temp\Test-Signed.ps1"

Potential use cases

RDP File Signing

Use the code signing certificate generated with New-CodeSigningCert.ps1 to sign .rdp files in order to avoid the certificate warning.

  • Create the .rdp file with all of the settings you'll need
  • Generate a certificate using New-CodeSigningCert
  • Get the thumbprint of the certificate you'll use to sign the .rdp file with Get-ChildItem -Path Cert:CurrentUser\My
  • Run rdpsign.exe /sha1 <thumbprint> C:\Path\To\workstation.rdp
  • Configure group policy to trust the certificate

About

Create and use code signing certificates with PowerShell

Topics

Resources

License

Code of conduct

Security policy

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published