I have always been a big scripting fan. Scripts make the IT-admin-life so much easier. That is why I always am shocked when IT guys say they hate scripting.

When ESX 4.1 was released I was very happy to hear that VMware is now supporting kickstart scripting in ESXi. Trying it out, I found liam his article about kickstart scripting ESXi (http://www.virtuallyghetto.com/2010/09/automating-esxi-41-kickstart-tips.html). If you don't know liam, you have been living under a rock. This guy is one of the best vmware scripters out there and is quite famous for his perl linkedclone script.

One of the cool things he mentions is tip 7 on how to execute vi api commands via the mob web interface. Playing around with it I made some -hopefully useful- scripts for everybody to play with.
  • date.py : set the date and time
  • dns.py : to set your hostname,dns servers, domain and searchdomains
  • domain.py : join your ESXi hosts to a domain
  • maintmode.py : to enter/exit maintenaince mode
  • gateway.py : to alter your gateway
  • service.py : to start/stop/auto on or off a service like for example ntpd
  • ntp.py : configure ntp servers and on or off of the service
The scripts use the simplymob.py to do the webhandling (so that i didn't have the copy it all over again). The script has to be in the same location of the script you are using.

You can find all the files here