Create Patch Baselines and Remediate Hosts in a Cluster

SCRIPT SYNOPSIS / REASON CREATED – With Several Hundred Hosts in our environment, we seemingly are constantly applying host patches…many times, before we get all hosts updated to a current version, there are additional patches/fixes that need to be applied. The goal for this script is to make it easier to update all VMHosts in a designated cluster.

OVERVIEW OF STEPS – After manually putting the host(s) to be remediated into Maintenance Mode, the script below connects to vCenter, creates custom baselines (if not previously created), attaches baselines to the designated cluster, scans for needed patches, and then remediates the host(s) while disabling Power Management/FT/HA and runs simultaneously on all hosts in the cluster.



Complex Script – Rename vDS attached hosts from IP to DNS Name

SCRIPT SYNOPSIS / REASON CREATED — We have several hundred hosts in various DCs around the world, and the majority of these hosts were connected to vCenter via the IP address rather than the DNS Name, which we wanted to change.  We are running vSphere ESXi 5.5 on all hosts, and each host is connected to a site vDs, which added complexity to this renaming process.  This “complex” script is comprised of seven separate steps and should be run on hosts that are already in Maintenance Mode.

OVERVIEW OF STEPS — After manually putting the host(s) into Maintenance Mode, the script below connect to vCenter, migrate the host(s) from the vDS to a vSS, remove the host from the vDS (after the physical NICs are attached to the vSS), take the IP address of the host(s) and perform a reverse-DNS Lookup which is then piped out to a variable, remove the host(s) from vCenter, add the host(s) back to vCenter using the DNS variable previously created, add the host(s) back to the existing vDS and migrate the vmk ports and physical NICs from the vSS back to the vDS, and then disconnect from the vCenter.


"Do or Do Not. There is no Try" – Yoda