Skip to content

Commit

Permalink
Fix variable name certfileMY
Browse files Browse the repository at this point in the history
Add check for friendly name, use Subject if not present
  • Loading branch information
styx-tdo committed Jul 25, 2024
1 parent 6e314ce commit c97842f
Showing 1 changed file with 13 additions and 4 deletions.
17 changes: 13 additions & 4 deletions scripts/Win_IIS_Check_SSL_Certs.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,10 @@
.INSTRUCTIONS
Add this as a script check to your Windows Server that has IIS installed.
.NOTES
Version: 1.0
Version: 1.1
Author: ebdavison (nalantha on discord)
Creation Date: 2022-08-08
Updated: 2024-07-25 styx-tdo
#>

param
Expand Down Expand Up @@ -60,13 +61,21 @@ $CertState = foreach ($bind in $bindingslist) {

if ($certFileWH.NotAfter) {
if ($certFileWH.NotAfter -lt $Days) {
"$($bindsite) = $($certfileWH.FriendlyName) / $($certfileWH.thumbprint) will expire on $($certfileWH.NotAfter)"
if (certfileWH.FriendlyName) {
"$($bindsite) = $($certfileWH.FriendlyName) / $($certfileWH.thumbprint) will expire on $($certfileWH.NotAfter)"
}else{
"$($bindsite) = $($certfileWH.Subject) / $($certfileWH.thumbprint) will expire on $($certfileWH.NotAfter)"
}
}
}

if ($certFileMY.NotAfter) {
if ($certFileMY.NotAfter -lt $Days) {
"$($bindsite) = $($certfileMY.FriendlyName) / $($certfileMY.thumbprint) will expire on $($certfileWMY.NotAfter)"
if (certfileMY.FriendlyName) {
"$($bindsite) = $($certfileMY.FriendlyName) / $($certfileMY.thumbprint) will expire on $($certfileMY.NotAfter)"
}else{
"$($bindsite) = $($certfileMY.Subject) / $($certfileMY.thumbprint) will expire on $($certfileMY.NotAfter)"
}
}
}
}
Expand All @@ -78,4 +87,4 @@ if (!$certState){
} else {
Write-Output $CertState
exit 1
}
}

0 comments on commit c97842f

Please sign in to comment.