How to retrieve expiration date of specified certificate for user and machine.
<# .SYNOPSIS This script to provide user/machine date of expiration for specified cert in certificate store .DESCRIPTION This script to provide user/machine date of expiration for specified cert in certificate store .PARAMETER -issuer use -issuer parameter to include your certificate name .EXAMPLE get-certExpiration -issuer "KTSubCA0*" #> Function get-certExpiration { param( [CmdletBinding()] [parameter(mandatory = $true)][String]$issuer ) #######################################################################3 $user = Get-ChildItem -r "Cert:\CurrentUser\my" | Where-Object {$_.Issuer -match $issuer } | select subject, issuer, @{n='ExpireInDays';e={($_.notafter)}} $machine = Get-ChildItem -r "Cert:\LocalMachine\my" | Where-Object {$_.Issuer -match $issuer } | select subject, issuer, @{n='ExpireInDays';e={($_.notafter)}} $report = $user, $machine $report ###################################### #### you can save and export data to CSV file #$user | Export-Csv c:\Report-cert.csv -Append -NoTypeInformation #$machine |Export-Csv c:\Report-cert.csv -Append -NoTypeInformation }