Is there a way to use the PowerCLI to update VMWare tools on all Windows VM's to the latest version. I know I can do this individuall but I wanted to see if there way a way to use something similar to a for each loop to loop through the VM's one at a time. I am new to the vmware power cli along with the vix api and this is the first task I am trying to automate (automating the installation of all guests including linux would be fine if I could loop through all guests using the same command). I am a new so detailed explanations would be greatly appreciated.
Thank you,
Loren
This is quite simple in PowerCLI, you just combine 2 cmdlets with a pipeline.
Get-VM | Update-Tools
You can make the selection of the guests a bit more complex.
For example:
Get-VM -Name Srv* | Update-Tools
will only update the tools on guests whose name starts with SRV.
See the Get-VM cmdlet for more details.
You can also define it the tools update should reboot immediatly if required.
This you can do with the NoReboot parameter on the Update-Tools cmdlet.
Get-VM -Name Srv* | Update-Tools -NoReboot
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
This is quite simple in PowerCLI, you just combine 2 cmdlets with a pipeline.
Get-VM | Update-Tools
You can make the selection of the guests a bit more complex.
For example:
Get-VM -Name Srv* | Update-Tools
will only update the tools on guests whose name starts with SRV.
See the Get-VM cmdlet for more details.
You can also define it the tools update should reboot immediatly if required.
This you can do with the NoReboot parameter on the Update-Tools cmdlet.
Get-VM -Name Srv* | Update-Tools -NoReboot
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
Is it possible to pass the names from a .csv or .txt file?
Thank you,
Loren
Yes it is
get-content c:\list.txt | foreach {
update-tools -vm $_
}
or
import-csv c:\list.csv | foreach {
update-tools -vm $_.Name
}
For the text file make sure that each line contains only the VM Name.
For the csv file - the column with the VM should be titled Name.
Maish
VMware Communities Moderator
Co-Author of VMware vSphere Design
Thank you both very much this did the trick!
Thanks,
Loren