Skip to content

Instantly share code, notes, and snippets.

@DamianStanger
Created March 9, 2015 09:41
Show Gist options
  • Save DamianStanger/e42562fe3b0e4c745b6a to your computer and use it in GitHub Desktop.
Save DamianStanger/e42562fe3b0e4c745b6a to your computer and use it in GitHub Desktop.
IIS Certificate installation
write-host "Apply the certName cert" -ForegroundColor Green
$cert = dir cert:\localmachine\my | where-object{$_.subject -like "*.certName.*"}
if(!$cert){
$cert = dir cert:\localmachine\webhosting | where-object{$_.subject -like "*.certName.*"}
}
if(!$cert){
throw [System.Exception] "No ssl cert found that matches the search '*.certName.*'"
}
new-item "IIS:\SslBindings\0.0.0.0!443" -Value $cert
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment