Connect-VIServer -Server <IP of DNS name of Vcenter> -user <NETBIOSDomain\username> -password <password> $VMs = Get-VM foreach ($vm in $VMs) { $ToolsStatus = $vm.ExtensionData.Guest.ToolsStatus if ($ToolsStatus -ne "toolsOK") { Write-Host "Updating the tools of" $VM.Name $vm | Update-Tools -NoReboot } }