4 Commands to maintain a local code singing cert.
7 $certName = "Local Code Sign Cert"
9 function New-CodeSignCert {
11 $cert = New-SelfSignedCertificate -CertStoreLocation Cert:\CurrentUser\My -Type CodeSigningCert -Subject "$certName"
15 function Get-CodeSignCert {
16 return Get-ChildItem -Path Cert:\CurrentUser\My | ? Subject -EQ "CN=$certName"
19 function Set-CodeSignCert {
21 $cert = Get-CodeSignCert
22 Move-Item -Path $cert.PSPath -Destination "Cert:\CurrentUser\Root"
25 function Invoke-SignScript {
29 $cert = Get-CodeSignCert
30 Set-AuthenticodeSignature -FilePath $Path -Certificate $cert