PowerCLI: provisioning a single vSphere host


Last week I was working on an environment running VMware vSphere Enterprise licenses. The job at hand was to expand the compute environment with some new blades. Due to the lack of host profiles, I wanted to be able to provision a new host with all the necessary datastores from CSV and all the correct vSwitch settings.

The scripts connects to vCenter, and asks which vSphere host you want to provision using their hostname. I used 2 functions; The first is used to configure the vSwitch settings, the second to configure the NFS advanced settings along with creating the datastores from a CSV file.