<#
.SYNOPSIS
   Generates an SSL certificate status report for all of the hosts/ports listed in the
   Certificates.csv input file.

.DESCRIPTION
   Generates an SSL certificate status report for all of the hosts/ports listed in the
   Certificates.csv input file.

.NOTES
   Written by Michael Goulart

.EXAMPLE
   .\Check-SSLCertStatus.ps1

   Hostname                         SerialNumber                           NotAfter                SANs
   --------                         ------------                           --------                ----
   server001.contoso.com      3C00001F5A926069237B47AF33000000001F5A 6/21/2019 8:45:16 AM    *.contoso.com 
   server001.contoso2.com     3C000017FAD7D584AC44CB17E00000000017FA 4/17/2019 2:48:16 PM    *.contoso2.com 
   server001.contoso3.com     3C0000239B5538BE8555AF297300000000239B 9/12/2019 9:52:49 AM    *.contoso3.com 
   ...

.INPUTS
   None - this script does not accept input from the pipeline; the systems being checked are
   stored in the Certificates.csv file in directory the script is in.

.OUTPUTS
   PSObjects with the certificate data for each end point in the input file

#>


Process {
   $Certs = Import-Csv "$PSScriptRoot\Certificates.csv"
   ForEach ($Cert in $Certs) {
      .\Get-SSLCertInfo.ps1  $Cert.hostname $Cert.port | select-object State,@{n='Hostname'; e={$_.computer}} ,SerialNumber,NotAfter, @{n='SANs';e={$_.DnsNameList.PunyCode -join " "}}
   }
}

0 Comments

Leave a Reply

Avatar placeholder

Your email address will not be published. Required fields are marked *