$certificateName = Read-Host -Prompt 'Enter name of your certificate e.g. MyCert or [email protected]'
$cert = New-SelfSignedCertificate -DnsName $certificateName -CertStoreLocation Cert:\CurrentUser\My\ -Type Codesigning -NotAfter (Get-Date).AddYears(3)
$certThumprint = Read-Host -Prompt 'Enter thumbprint of your certificate'
$cert = Get-ChildItem -Path Cert:\CurrentUser\My\ | Where { $_.Thumbprint -eq $certThumprint }
This can be done manually using certmgr.msc
or using the following commands: