Every x years ssl certificates need to be renew for the vSphere infrastructure. So in order to do this I needed a way to validate SSL expiration date. Well the thing is I don’t know an automated way of doing this.
I started by look around google to see if there wasn’t a smart guy who had already done something like this and it turns out there is, so please put your hands together for Vadims Podans and is blog post Test remote web server SSL certificate. With credit due, I’ll continue with my small contribution.
How to validate SSL expiration date
What Vadims have created is a powershell function to test SSL certificates, but as I was only interested in limited, automated vSphere SSL oriented certificates I added that some lines to a script to make this possible. Simple put, fire up powercli, login to the vCenter in question and execute the script. What you will end up with is a csv file, with ESXi hostnames and the date of the certificates expiration date. Now it just a matter of getting them all updated with the latest certificate.
My small contribution to this script is the last 11 lines, where it creates a list of host, foreach host get the expiration date and export it to a csv file.