vCenter Server 7.x
vCenter Server 8.x
The previous connection saved in Vmware Powercli for the vCenter would have saved the old thumbprint from the old certificate used in MACHINE_SSL.
Once the certificate is replaced a thumbprint from the certificates needs to saved and trusted.
Re-enable SSL Certificate Validation: After you’ve connected and accepted the new thumbprint, you might want to re-enable SSL certificate validation. Use this command to reset the configuration:
Set-PowerCLIConfiguration -InvalidCertificateAction Prompt -Confirm:$false
By following these steps, you will have accepted the new thumbprint and ensured your PowerCLI session is configured to handle SSL certificates properly.
Option 2
To reconnect to a vCenter Server using PowerCLI and accept the thumbprint, you can use the following approach:
Disconnect from vCenter (if connected):
Disconnect-VIServer -Server <vCenterServer> -Confirm:$false
Reconnect to vCenter and handle the thumbprint:
Use the Connect-VIServer cmdlet. If the thumbprint of the vCenter Server's SSL certificate has changed or is not trusted, you'll need to accept it manually. PowerCLI will prompt you to accept the thumbprint if it's not already trusted.
$server = "<vCenterServer>"
$username = "<Username>"
$password = "<Password>"
Connect-VIServer -Server $server -User $username -Password $password -Force
When you run this command, if the thumbprint is not trusted or has changed, PowerCLI will prompt you to accept the new thumbprint. You’ll need to respond to this prompt interactively.
Note: For automated scripts where interactive thumbprint acceptance isn’t possible, you might need to handle thumbprint validation and acceptance programmatically. This usually involves fetching the thumbprint and pre-accepting it using a script, but handling thumbprint acceptance interactively is the most common method.
If you are automating and want to handle thumbprints without prompts, ensure your environment is set up to manage and trust certificates properly, perhaps using an internal certificate authority (CA) or configuring certificate thumbprints manually in your PowerCLI scripts.
Example of accepting thumbprint manually:
$server = "<vCenterServer>"
$credential = Get-Credential
# Connect to the vCenter Server
Connect-VIServer -Server $server -Credential $credential -Force
Note: Make sure to replace <vCenterServer>, <Username>
, and <Password>
with your actual vCenter server address and credentials.