Skip to content

Instantly share code, notes, and snippets.

@ehrnst
Last active July 12, 2023 13:55
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save ehrnst/fccc14760a4bf7597979377deef29f82 to your computer and use it in GitHub Desktop.
Save ehrnst/fccc14760a4bf7597979377deef29f82 to your computer and use it in GitHub Desktop.
Request and install a certificate from template using powershell
# Request the certificate throuh template called "WebServer"
Get-Certificate -Template "WebServer" -DnsName "computername.fqdn" -CertStoreLocation cert:\LocalMachine\My -SubjectName "CN=computerName.fqdn, C=CountryCode, L=MyCity, O=Organization OU=Department, S=State"
# After approval. Use request to download and install cert
$cert = (get-childItem -path cert:\LocalMachine\Request)
get-certificate -Request cert:\LocalMachine\Request\$cert
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment