Powershell: Get SHA256 Thumbprint from vCenter server using Powershell Core. (NSX-T Compute Manager Registration related)

Summary:
Had a need to pull a target vCenter's SSL certificate and convert it's thumbprint to SHA256 format to register to NSX-T Manager using Powershell core.  Servicepoint was not available in Core.

Noticed also recently Lam updated his approach to take Core into account.  My approach is slightly different and my script will also return the certificate object back if you so choose rather than just the SHA256 value.  Anyway, I've tested in PS Core 6.0.4 and 6.1 on Ubuntu, CentOS, and MacOS and my function seems to work fine.  Let me know if you see otherwise.

GIST below:

Comments

Unknown said…
Hi Chris,

I am in a learning curve of PowerShell, if you don't mine can you please walk me through how to use this script.


Thanks for understanding.


Chris Nakagaki said…
Sure thing. To use it is quite simple. From a PowerShell window, you can simply copy all the text on this page and paste into that PowerShell window. Once you do that, you can now call that function by typing “Get-SSLCert google.com” without the quotes. That’s one way to use it. Other ways are by simply saving the code above into a ps1 file (literally a text document with a .ps1 extension instead of a .txt) and using import-module nameofps1file.ps1.