It was bound to happen at some point and this morning William Lam published a script which enables you to add a host to your vCenter server during the scripted install. Now I have seen many cool scripts from William passing by over the last year or two but I feel that although this was probably not the most difficult one to write is is a brilliant piece of work. I tried this myself 18 months ago during a project and got stuck and decided the time needed did not weigh up against the costs associated. Thanks William for getting the job done.

Here's an exerpt from William's post, head over to his blog for the script!

How to automatically add ESX(i) host to vCenter in Kickstart

While recently updating my Automating Active Directory Domain Join in ESX(i) Kickstart article, it reminded me an old blog post by Justin Guidroz who initially identified a way to add an ESXi host to vCenter using python and the vSphere MOB. The approach was very neat but was not 100% automated as it required some user interaction with the vSphere MOB to identify certain API properties before one could potentially script it within a kickstart installation.

I decided to revisit this problem as it was something I had investigated awhile back. There are numerous ways on getting something like this to work in your environment, but it all boils down to your constraints, naming convention and provisioning process. If you have a well defined environment and utilizing a good naming structure and can easily identify which vCenter a given ESX(i) host should be managed from, then this can easily be integrated into your existing kickstart with minor tweaks. This script was tested on vCenter 4.1 Update 1 and ESXi 4.1 and 4.1 Update1.