VMware Cloud Community
mark_chuman
Hot Shot
Hot Shot
Jump to solution

Ignorning Server Certificate Alerts

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
}

Reply
0 Kudos
1 Solution

Accepted Solutions
alanrenouf
VMware Employee
VMware Employee
Jump to solution

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
}
Blog: http://virtu-al.net Twitter: http://twitter.com/alanrenouf Co-author of the PowerCLI Book: http://powerclibook.com

View solution in original post

Reply
0 Kudos
5 Replies
alanrenouf
VMware Employee
VMware Employee
Jump to solution

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
}
Blog: http://virtu-al.net Twitter: http://twitter.com/alanrenouf Co-author of the PowerCLI Book: http://powerclibook.com
Reply
0 Kudos
LucD
Leadership
Leadership
Jump to solution

You can also fix the certificate problem Smiley Wink

See KB1009407.


Blog: lucd.info  Twitter: @LucD22  Co-author PowerCLI Reference

alanrenouf
VMware Employee
VMware Employee
Jump to solution

Yes of course that is the prefered method Smiley Wink

Blog: http://virtu-al.net Twitter: http://twitter.com/alanrenouf Co-author of the PowerCLI Book: http://powerclibook.com
mark_chuman
Hot Shot
Hot Shot
Jump to solution

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).

Reply
0 Kudos
LucD
Leadership
Leadership
Jump to solution

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

Reply
0 Kudos