VMware PowerCLI upgrade VMware Tools


My searches for a script to upgrade the VM Tools without rebooting were all more complicated than I wanted to implement. ¬†After hacking several scripts I found I was able to create a ‘simpler’ command to take care of my needs and should be easy to edit for anyone else.

Get-View -ViewType "VirtualMachine" -Filter @{"Guest.GuestFamily"="windowsGuest"; "Guest.ToolsStatus"="ToolsOld"; Guest.GuestState"="running"; "Name"="Partial_VM_Name*"} | foreach{get-VM $_.Name | Update-Tools -NoReboot}

Another option to limit selection to a particula datacenter, cluster, resource pool, host or folder.

Get-VM "OptionalFilter" -Location (Get-Cluster "OptionalFilter" ) | select @{N="Name"; E={$_.Name}}, @{N="Tools"; E={($_ | Get-View).Guest.ToolsStatus}} | where {$_.Tools -eq "toolsOld"} | foreach{get-VM $_.Name | Update-Tools -NoReboot}

Only want the output of VMs with old tools, just remove the last foreach and you’ll get a list.

Leave a comment

Your email address will not be published. Required fields are marked *