Checking SSL certificate values with Powershell For anyone that needs to check SSL certificates in a simple way from Powershell, I created something for this purpose a while back. It works for most SSL connections using.NET code and will throw exceptions if the name on the cert you provide is not valid, or the cert is expired. Using PowerShell With Certificates. Working With Certificates in PowerShell. If you Google with Bing you’ll see a whole bunch of blog posts that show fairly long-winded examples of creating self-signed certificates using the.NET X509Certificate2 class. Turns out it’s so much simpler than that.
Don't use format-list, you already have all the properties. format-list will convert your nice X509Certificate2 object into a set of format objects which isn't what you want at all. Also use -expandproperty on the select:
Or with Powershell 3 or later, use the shorthand notation: