# make sure this PFX file exists or create one # or load a code-signing cert from other sources # (review the previous tips for hints) $pfxFile = "$home\desktop\tobias.pfx" $cert = Get-PfxCertificate-FilePath$pfxFile
# make sure this folder exists and contains # PowerShell script that you'd like to sign $PathWithScripts = 'c:\myScripts'
# apply signatures to all scripts in the folder Get-ChildItem-Path$PathWithScripts-Filter *.ps1 -Recurse | Set-AuthenticodeSignature-Certificate$cert
# apply signatures to all scripts in the folder Get-ChildItem-Path$PathWithScripts-Filter *.ps1 -Recurse | Set-AuthenticodeSignature-Certificate$cert-TimestampServer http://timestamp.digicert.com