WARNING: There were one or more problems with the server certificate:
* The X509 chain could not be built up to the root certificate.
* The certificate's CN name does not match the passed value.
Using a password reset script and the above error shows in the output. Anyone know of a way to add something in the script that instructs to ignore these and not display?
This is the part of the script that produces the notification. It works fine, but if there is a simple line or something that would ignore the alerts that would be helpful.
$curesx = $_
write-host "Setting password on "$curesx
connect-viserver $curesx -User root -Password $currentpassword
set-vmhostaccount -UserAccount root -Password $newpassword -GrantShellAccess $True
disconnect-viserver * -confirm:$false
}
You can use the following to remove the certificate warning message:
$curesx = $_
write-host "Setting password on "$curesx
connect-viserver $curesx -User root -Password $currentpassword -ErrorAction SilentlyContinue
set-vmhostaccount -UserAccount root -Password $newpassword -GrantShellAccess $True
disconnect-viserver * -confirm:$false
}
You can use the following to remove the certificate warning message:
$curesx = $_
write-host "Setting password on "$curesx
connect-viserver $curesx -User root -Password $currentpassword -ErrorAction SilentlyContinue
set-vmhostaccount -UserAccount root -Password $newpassword -GrantShellAccess $True
disconnect-viserver * -confirm:$false
}
You can also fix the certificate problem
See KB1009407.
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
Yes of course that is the prefered method
Where is the button for wise-guy response? :smileylaugh:
That's interesting because we've replaced the default vCenter certs, but still getting the alert. This must be the connection to the ESX server. When I test out a "connect-viserver" straight to the vCenter server there is no such error (except when I don't use the fully qualified name or name use when building the cert).
If it is ESX servers (and not ESXi), you could try the openssl cmd from KB1009092
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference