Skip to content

Instantly share code, notes, and snippets.

@AlesRuzickaEu
Created October 19, 2017 13:29
Show Gist options
  • Save AlesRuzickaEu/c906ef4e4af8a843afc303882cdf1ab9 to your computer and use it in GitHub Desktop.
Save AlesRuzickaEu/c906ef4e4af8a843afc303882cdf1ab9 to your computer and use it in GitHub Desktop.
Sign Powershell Scripts
function Sign-File(
[Parameter(Mandatory=$True,Position=0,ValueFromPipeline)]
[string[]]
$FilePath) {
Set-AuthenticodeSignature $FilePath $(Get-ChildItem -Path cert:\CurrentUser\my -CodeSigningCert)
}
function Sign-Directory(
[Parameter(Position=0)]
[string[]]
$Directory = '.') {
$cert = Get-ChildItem -Path cert:\CurrentUser\my -CodeSigningCert
Get-Item *.ps1 | Set-AuthenticodeSignature -Certificate $cert
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment