Changing ESXi root passwords the smart way (via PowerCLI)

Written by Sam McGeown
Published on 4/6/2013 - Read in about 1 min (182 words)

PowerCLI LogoIf you work in company with strict password compliance rules, for example under SOX, you might well have to change administrator passwords every month. Doing this on any more than a few hosts is tedious work – even on two hosts it seems like a waste of time logging on the host via SSH (or even enabling it first) before changing the password. Then we also need to audit the change, there’s no point making it for compliance reasons if we can’t then prove we did it!

Changing ESXi passwords the manual way

Steps taken from VM KB 1004659

  1. Log on to SSH as root, or log on and use “su –“ to get root level access
  2. Use “passwd root” to change the root password
  3. Log off and log back on using the new password to test access

Rinse and repeat

Changing ESXi root passwords the smart way (via PowerCLI)

The script is fairly heavily commented, usage is as follows:

.\Change-HostPasswords.ps1 -vCenter VC-01.definit.local -Location “DefinIT Lab”

Source code for this has moved to GitHub to allow a bit more structured collaboration:

https://github.com/sammcgeown/Change-HostPasswords/blob/master/Change-HostPasswords.ps1

Share this post