Comment

Check lines 206 and 208, you are putting the key file in the cert store and the crt file in the key store. Right now this script hangs esxi once you restart the services.

Correct lines are:

# Upload SSL certificate
$objWebClient.UploadFile(($strESXiURL + "/host/ssl_cert"),"PUT",$strHostCertFile)
# Upload SSL key
$objWebClient.UploadFile(($strESXiURL + "/host/ssl_key"),"PUT", $strHostKeyFile)

Really useful script anyway!