Skip to content

Commit

Permalink
Only removed expired certificates. Keep certificates that are in the …
Browse files Browse the repository at this point in the history
…expiration window.
  • Loading branch information
jimmyca15 committed Aug 9, 2017
1 parent 72b5ce9 commit 0e6ec30
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions scripts/setup/migrate.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -191,10 +191,10 @@ function Migrate {

.\security.ps1 Set-Acls -Path $Destination

# Remove unused IIS Administration certificates expiring in less than 3 months
# Remove expired IIS Administration certificates
$certs = .\cert.ps1 Get-IISAdminCertificates
foreach ($cert in $certs) {
if ((([System.DateTime]::Parse($cert.GetExpirationDateString()) - [System.DateTime]::Now).TotalDays -lt $(.\globals.ps1 CERT_EXPIRATION_WINDOW)) -and $cert.Thumbprint.ToLower() -ne $sslBindingInfo.CertificateHash.ToLower()) {
if ((([System.DateTime]::Parse($cert.GetExpirationDateString()) - [System.DateTime]::Now).TotalDays -lt 0) -and $cert.Thumbprint.ToLower() -ne $sslBindingInfo.CertificateHash.ToLower()) {
Write-Verbose "Removing old IIS Administration Certificate"
.\cert.ps1 Delete -Thumbprint $cert.Thumbprint
}
Expand Down

0 comments on commit 0e6ec30

Please sign in to comment.