Lets face it, repetition sucks. When provisioning ESX hosts, using such things as the EDA make life easier, but it only does so much for ESXi.

The install for ESXi is simple and straight forward, but when done, you have to go and set everything else (IP, hostname, DNS, local users, etc…). Doing this for 20 hosts could be a PITA (Pain In The A..), so I set out on writing a script that does all of this for you.

All you have to do is set the IP & root password, then verify you can ping the host by it’s hostname (set host/A record in DNS). Once that’s verified, here’s what the script does for you:

  • Creates an Admins group and assigns it to the Administrator role
  • Creates local users, sets their default password, and adds them to the Admins group
  • Sets primary & secondary NTP & DNS servers
  • Sets DNS search suffix
  • Combines the provided hostname with DNS search suffix to populate the hostname FQDN
  • Sets EnableNaviReg to 0, disabled (requested by my storage team)
  • Disables iSCSI (disabled by default, but enabled in my sd image I created from previous post, thus the need to disable)
  • Disabled Tech Support Mode, aka ‘unsupported’ console

This is a slightly more advanced script, and it’s not fully polished, but works.

To run this script, save it as Set-Config.ps1, and run:

.\Set-Config.ps1 -vmhosts ("host1","host2","host3") -vmusers ("user1","user2")


.\Set-Config.ps1 -vmhosts host -vmusers user

Should you want to not disable EnableNaviReg, simply add at # in front of that line, same with Tech Support Mode or iSCSI.

Since Tech Support Mode is ‘unsupported’ by VMware, I disable it so we don’t rely on it. If something needs to be ‘fixed’, we need to find a supported way to get that done. So far, our biggest hurdle was lack of CNA drivers for our hosts that ONLY use the CNA’s to connect, but using a host connected through the LOM, we were able to inject the drivers just fine.

I also wanted to enable lockdown mode via this script, but it’s not currently available.

I imagine you could use this to config ESX as well, and add such things as adding users to sudoers, but our plan is to move to ESXi only, so I haven’t tested it with full ESX.

**UPDATED 03-26-2012**
I’ve test this with ESXi 5.0 and it works. Some of the commands are older and PowerCLI will bark at you for them, but they still work. I’ll update for 5.0 and repost when I have time.