Validating Bulk ESXi root password

This post was originally published on this site

Hi All,


I’m trying to validate the bulk ESXi password, but it fails with an error Log write function. Any help will be appreciated. It appears SSH  services need to be started prior to running the script.


after enabling the ssh services there is no error using Write-host function as per my understanding.



$esxNames = Get-Content -Path ‘C:tmplist.txt’

$user = ‘root’


$pswds = ‘pswd1’, ‘pswd2’, ‘pswd3’

foreach ($esx in $esxNames)





   $i = 1



   foreach ($pswd in $pswds)









   Connect-VIServer -Server $esx -User $user -Password $pswd -ErrorAction Stop | Out-Null



  LogWrite “Host $esx password$i is correct”



   Disconnect-VIServer -Server $esx -Confirm:$false















  LogWrite “Host $esx password$i failed”

















Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.