ADVERTISE HERE

VM Start-up script

Title: VM Start-up script
Author(s): (VIRTU-AL) Alan Renouf
Target Audience: Technical - Intermediate
Current Revision:
First Published: 14 December 2011
Products: VMware
UID: XD10469

Back in Jan 2010 I wrote a script which shut down the virtual infrastructure

Punchy Text: 

Back in Jan 2010 I wrote a script which shut down the virtual infrastructure

Alan Renouf is a community peer for VMware PowerCLI, Virtu-Al.Net.  In 2009, he was named a vEXPERT by VMware.  Alan's main focus is to teach and help other VMware admins automate their VMware infrastructures and make their lives easier through automation.
www.virtu-al.net.


Back in Jan 2010 I wrote a script which shut down the virtual infrastructure, this was used to ensure your VMs were shut down and then your hosts were shut down in an orderly manner, ideal for things like UPS shutdown scripts etc.

A slight spin on that is a Start-Up script, I was asked by a couple of people if I had one of these, it also becomes more relevant with the vCenter Virtual appliance, no need for HA and DRS rules or to manually search for the vCenter Virtual Appliance if there is a power outage.

The script below will connect to all hosts you define at the start, these could obviously be read from a csv, xml file or a database etc but I just define them in a variable for ease of the script.

The script will firstly connect to each of these hosts in turn, once connected it will search for the first VMs, in my case this is a couple of domain controllers, it could be database servers or any other infrastructure servers which need to come up before vCenter. Once these VMs have been found the script will start them and wait for their tools status to be ready, this is an easy way to check that the VM is started completely.

Once the infrastructure servers are started it will then search for your vCenter VM, this could be on any of the connected hosts, it will start it and again wait until the tools return as being completely started.

The Script

The Script

In Action

Spotlight:

VMware Documentation Downloader v11.08.30

Updated for vSphere 5 - A free tool for those on the move who need information FAST

vSphere 5 License Entitlement Changes

See what has changed in the license entitlement in vSphere 5?

Thin Client vs Zero Client

The differences between Thin and Zero desktop clients for VDI

Technology Exchange: