Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save camieleggermont/68a6dfd7f8d0e6dafff0cc41210737c0 to your computer and use it in GitHub Desktop.
Save camieleggermont/68a6dfd7f8d0e6dafff0cc41210737c0 to your computer and use it in GitHub Desktop.
$cert = New-SelfSignedCertificate -DnsName "localhost", "localhost" -CertStoreLocation "cert:\LocalMachine\My" -NotAfter (Get-Date).AddYears(5)
$thumb = $cert.GetCertHashString()
For ($i=44300; $i -le 44399; $i++) {
netsh http delete sslcert ipport=0.0.0.0:$i
}
For ($i=44300; $i -le 44399; $i++) {
netsh http add sslcert ipport=0.0.0.0:$i certhash=$thumb appid=`{214124cd-d05b-4309-9af9-9caa44b2b74a`}
}
$StoreScope = 'LocalMachine'
$StoreName = 'root'
$Store = New-Object -TypeName System.Security.Cryptography.X509Certificates.X509Store -ArgumentList $StoreName, $StoreScope
$Store.Open([System.Security.Cryptography.X509Certificates.OpenFlags]::ReadWrite)
$Store.Add($cert)
$Store.Close()
@skironDotNet
Copy link

skironDotNet commented Jul 28, 2020

I think line 9 is incorrect, and worked for me with as single quotes appid='{214124cd-d05b-4309-9af9-9caa44b2b74a}'

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment