One of the great things about vSphere VMs is that there are a lot of automation options. This can include the vSphere scheduled tasks inventory, in-guest operating system tricks, commands pushed centrally through something like Group Policy, and also events configurable through VMware Tools.
If you are using vSphere, you should definitely install VMware Tools on the VMs. Further, you should keep it up to date. There are a number of ways to perform VMware Tools updates, including automation with PowerCLI.
VMware Tools is a driver enlightenment kit that ensures that the guest virtual machine is aware of the hardware assigned to it from the hypervisor. Aside from being aware of the complete inventory of hardware, the proper drivers are provided as well.
VMware Tools has a simple, yet intuitive automation option that can be used for four distinct events: power guest operating system, shut down guest operating system, suspend guest operating system, and resume guest operating system. The first two events are major state events, and the last two deal with a frequent term referred to as “quiescence”. The act of quiescing a virtual machine puts the system in a clean state during the pause (and then the reverse for the resume). If you have virtual machines and applications that are picky; you may want to configure events with the VMware Tools installation on the guest VM to do a specific event for both the major state events and, possibly, the quiescence events as well.
Different VMware Tools installations across the wide range of operating systems will display these options differently. Linux VMs, for example, have a designated path for the quiescence events to be placed in: /usr/sbin/pre-freeze-script and /usr/sbin/post-thaw-script. Windows VMs have it easily located in the VMware Tools icon in the Systray. Figure A below shows the configuration of the scripted options for VMware Tools events:
These tasks will run on Windows systems with the security context of the VMware Tools service, which by default, is local system. Keep that in mind when deploying anything complicated for Windows in this path.
Do you use any scripting for VMware Tools to perform tasks on virtual machine events? If so, which? Share your comments below.