PowerCLI one-liner to validate ESXi root passwords.
· โ 2 min read · ๐ค Javy de Koning
Below is a PowerCLI one-liner you can use to validate if all your root passwords are what you expect them to be.
get-vmhost | %{ $null = connect-viserver $_.name ` -user root -password "MyFakePassword" -EA 0 if (-not ($?)) { write-warning "Password failed for $($_.name)" } else { Disconnect-VIServer $_.name -force -confirm:$false } } Reset a known password over PowerCLI Below is a short code snippet to help you change your root password on ESXi hosts.