Thursday, September 18, 2008

Updating tools on VM's in Vmware

Hi
 
I'm back, after a long break, with other important stuff on the horizon. I realize i have a couple of hundred vm's that needed the tools to be update and i didn't want to do it manually one by one. So i again looked into the VI-toolkit for Vmware and found it pretty easy to update all vm's with a simple script.
 
$VmList = Get-VM | Where-Object {$_.Powerstate -eq "PoweredON"} | % { Get-View $_.ID } | where {$_.guest.toolsstatus -notmatch "Ok"} | Select Name
foreach ($vm in $VmList) {
  "Updating :" $vm
  Update-Tools $vm
}
 
I hope this can help others.