Skip to content

Instantly share code, notes, and snippets.

@ChrFrohn
Last active September 22, 2022 18:06
Show Gist options
  • Save ChrFrohn/e39657f9692fcbac46fa0d1968402898 to your computer and use it in GitHub Desktop.
Save ChrFrohn/e39657f9692fcbac46fa0d1968402898 to your computer and use it in GitHub Desktop.
CreateCertForAppReg.ps1
$CN = "MyAppReg" #Name of your cert.
$cert=New-SelfSignedCertificate -Subject "CN=$CN" -CertStoreLocation "Cert:\CurrentUser\My" -KeyExportPolicy Exportable -KeySpec Signature -NotAfter (Get-Date).AddYears(5)
#Thumbprint - Make note of this
$Thumbprint = $Cert.Thumbprint
#Export cert. to download folder - FilePath can be changed to your linking
Get-ChildItem Cert:\CurrentUser\my\$Thumbprint | Export-Certificate -FilePath $env:USERPROFILE\Downloads\AppRegCert.cer
Write-Output "$Thumbprint <- Copy/paste this (save it)"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment