Powershell one-liner to remotely get SSL certificate expiration

This is a quick and dirty way of retrieving the self-signed SSL certificate that Exchange 2007 servers use out of the box.  Get-ExchangeCertificate only works locally on the box that has the certificate…not fun when you have a long list to find out so you can build a list for renewing them.  This uses psexec to connect to the remote server and retrieve any personal certificates and display the expiration date.  Short and sweet.

.\psexec \\server cmd /c "echo . | powershell (gci -path cert:\localmachine\my).notafter"

One thought on “Powershell one-liner to remotely get SSL certificate expiration

  1. Scott, you rock! …but where is the code listed? or is Get-‘ExchangeCertificate’ the complete command?

Leave a Reply

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

*