PS_Setup.TempPoint.ps1
#https://blogs.u2u.be/u2u/post/creating-a-self-signed-code-signing-certificate-from-powershell #Set-ExecutionPolicy -ExecutionPolicy RemoteSigned $Subject = "CN=PA1REG PSDxExpeditions Code Signing" $cert = New-SelfSignedCertificate -CertStoreLocation cert:\currentuser\my ` -Subject "$Subject" ` -KeyAlgorithm RSA ` -KeyLength 2048 ` -Provider "Microsoft Enhanced RSA and AES Cryptographic Provider" ` -KeyExportPolicy Exportable ` -KeyUsage DigitalSignature ` -Type CodeSigningCert ` -NotAfter (Get-Date).AddMonths(10*12) #$cert = New-SelfSignedCertificate -CertStoreLocation Cert:\CurrentUser\My -Type CodeSigningCert -Subject "U2U Code Signing" Get-ChildItem -Path Cert:\CurrentUser\My | ? Subject -EQ "$Subject" Move-Item -Path $cert.PSPath -Destination "Cert:\CurrentUser\Root" Set-AuthenticodeSignature -FilePath .\PSDxExpeditions.psm1 -Certificate $cert #Set-ExecutionPolicy -ExecutionPolicy AllSigned #$ReturnCert = Get-ChildItem -Path Cert:\CurrentUser\Root | ? Subject -EQ "$Subject" $CertPassword = ConvertTo-SecureString -String 'pa1reg' -Force �AsPlainText #Export-PfxCertificate -Cert "Cert:\CurrentUser\Root\$($ReturnCert.Thumbprint)" -FilePath .\PA1REG_DxExpeditions.pfx -Password $CertPassword Export-PfxCertificate -Cert "Cert:\CurrentUser\Root\$($Cert.Thumbprint)" -FilePath .\PA1REG_DxExpeditions.pfx -Password $CertPassword $CertPassword = ConvertTo-SecureString -String 'pa1reg' -Force �AsPlainText Get-ChildItem �Path .\PA1REG_DxExpeditions.pfx | Import-Certificate �CertStoreLocation Cert:\CurrentUser\Root -Password $CertPassword |