Hi guys- I have a task to move 300+ VMs from ESX3.5 to ESX4.0 and update tools in all guests after move is completed. The guests have mix bag of OS-windows 2000/2003/2008/linux/unix. Some of the VMs would need fresh installation of vmware tools and some would need upgrade. If it is only possible to provide script for windows, that would also work for me right now as majority of servers are windows.
I have gone through many forum discussion but nothing seems to be working for me. Can someone help with a script to acheive what I want to do.
I have downloaded latest powercli
Thanks!
You can install/upgrade VMware tools on all your virtual machines with the following PowerCLI script:
Get-VM | Get-View | ` Where-Object {$_.Guest.ToolsVersionStatus -ne "guestToolsCurrent"} | ` ForEach-Object {$_.UpgradeTools_Task("")}
Regards, Robert
Hi Robert- Thanks!. could you please suggest how i can do on selected guests. My cluster has other servers which i don't want to touch. Is it possible to pass specific guest VM names for upgrade/install.
If you want to install/upgrade the VMware Tools only on certain VM's you can add the VM name behind the Get-VM cmdlet on the first line of the script. Like:
Get-VM MyVM1,MyVM2,MyVM3 | Get-View | `
I modified the script as follows for one VM and executed it. But it failed saying "Cannot complete the opereation because vmware tool is not running on machine"
-Vinod
Just tried on a VM with old tools. Script failed with status "Error upgrading VMware Tools". This is windows 2008 VM. I tried from powercli
[vSphere PowerCLI] C:\update-tools vmname -noreboot
This failed as well with same error.
Check out this: http://communities.vmware.com/thread/256191
Also checkout few more things: http://kendrickcoleman.com/index.php?/Tech-Blog/error-upgrading-vmware-tools-vsphere-41.html
Could you please suggest how can i test the script on below link for specific VM. I want to pass on a servername.txt file to script.
Also-most of blogs talk about upgrading tools. Can you direct me to script for installing tools?
I never tried this script because we have different envirnment. But if you able to upgrade one VM then rest would be easy.
Do you have a method to install (not update) tools on windows/linux VMs.
Thanks!
Vinod
I meant how can I make this script to use a csv file containing my VM names.
If you want to install/upgrade the VMware Tools only on certain VM's you can add the VM name behind the Get-VM cmdlet on the first line of the script. Like:
Get-VM MyVM1,MyVM2,MyVM3 | Get-View | `
Use Import-CSV commandlet.
$myVM= Import-CSV "C:\vm.csv"
I am new to powershell, could you please put this in script. Thanks!
OK. I am not sure which script you may reffering too run but here is a smiple foreach loop. Main thing is get $VM.Name would return the list of machine.
CSV :
Name
VM1
VM2
VM3
Vm4
foreach ($VM in (Import-Csv -Path "c:\vmlist.csv"))
{
Get-View -ViewType "VirtualMachine" `
-Property Name,Guest `
-Filter @{"Name"=$VM.Name;
"Guest.GuestFamily"="windowsGuest";
"Guest.GuestState"="running"}
}
Hope this helps.