Change “Upgrade at Power Cycle” to enable automatic VMTools upgrades

VM Maintenance is a chore for most IT shops, but there are ways to make things easier! If your policies allow, you can set all VMs to upgrade VMTools on reboot. Since we usually reboot most VMs on a weekly or monthly basis, this makes it easy to allow the Tools to update whenever there is an ESXi update. This script will set the flag for all VMs in a datacenter, so keep that in mind.

Title: 		Sets the Tools Upgrade Policy to "Upgrade at Power Cycle"
Author: 	Michael Kenning (
Version: 	0.2 (beta)
Created:	08 SEP 2015
Updated: 	09 SEP 2015

$cluster = 'CLUSTERNAME'
$vcserver = "VCNAME"

Connect-VIserver $vcserver

$spec = New-Object VMware.Vim.VirtualMachineConfigSpec 
$ = New-Object VMware.Vim.ToolsConfigInfo 
$ = "upgradeAtPowerCycle"
Foreach($vmview in get-view -ViewType virtualmachine -SearchRoot (get-Cluster $cluster).id -Filter @{'Config.Tools.ToolsUpgradePolicy' = 'manual' } ) {
Tagged with: ,
Posted in PowerCLI

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s

%d bloggers like this: