Mass Toggle of vmtools Auto Update Settings

Posted: November 28, 2012 in Scripts, VMware

While I like having VMs update their tools on reboot, it can cause some issues with running SRM testing and planned migrations, causing timeouts while waiting for vmtools. Rather than increase the timeout or go through the hassle of raising a change to updated the tools across an environment, I used the following script block to disable auto update for all the VMs and re-enable it once it came across to the other side. All credit goes to Damian Karlson for this one. Just reposting so I have my own copy.

# Get all the VMs
$VMs = Get-VM

# Loop it through
ForEach ($vm in $VMs){
$spec = New-Object VMware.Vim.VirtualMachineConfigSpec
$spec.changeVersion = $vm.ExtensionData.Config.ChangeVersion
$ = New-Object VMware.Vim.ToolsConfigInfo
# Disable the auto update
$ = "manual"
$_this = Get-View -Id $vm.Id

To re-enable:
$ = "upgradeAtPowerCycle"

Thanks Damian!

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 )

Twitter picture

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

Facebook photo

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

Google+ photo

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

Connecting to %s