PowerCLI upgrade vmware tools on next reboot

I ran across this command somewhere and it’s really useful for the vCloud hosted environment where your tenants never upgrade their tools.   Of course you have to be allowed upgrade the tools make sure your not breaking your SLA or service contract by doing this.  Here is the command:

Foreach ($v in (get-vm)) {
$vm = $v | Get-View
$vmConfigSpec = New-Object VMware.Vim.VirtualMachineConfigSpec
$vmConfigSpec.Tools = New-Object VMware.Vim.ToolsConfigInfo
$vmConfigSpec.Tools.ToolsUpgradePolicy = "UpgradeAtPowerCycle"
$vm.ReconfigVM($vmConfigSpec)
}

Leave a Reply

Your email address will not be published.

This site uses Akismet to reduce spam. Learn how your comment data is processed.