Created
August 1, 2024 13:59
-
-
Save chaddoncooper/cc59597a4019656e3036412fe14335fc to your computer and use it in GitHub Desktop.
Powershell IIS remove certificate and bindings
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$ConfirmPreference = 'None' | |
$ApiPortBinding = 443 | |
$Subject = "SubjectName" | |
Get-ChildItem Cert:\localmachine\my | Where-Object { $_.Subject -match $Subject } | Remove-Item -Force | |
Get-ChildItem Cert:\localmachine\CA | Where-Object { $_.Subject -match $Subject } | Remove-Item -Force | |
Get-ChildItem Cert:\localmachine\root | Where-Object { $_.Subject -match $Subject } | Remove-Item -Force | |
if (-Not (netsh http show sslcert ipport=0.0.0.0:$(ApiPortBinding) | find "The system cannot find the file specified")) | |
{ | |
netsh http delete sslcert ipport=0.0.0.0:$(ApiPortBinding) | |
} | |
if (-Not (netsh http show sslcert ipport=0.0.0.0:$(FrontendPortBinding) | find "The system cannot find the file specified")) | |
{ | |
netsh http delete sslcert ipport=0.0.0.0:$(FrontendPortBinding) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment