VMware Cloud Community
mhhdaniel
Contributor
Contributor
Jump to solution

Updating VMWare tools on all Windows VM's

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

Loren E. Daniel Cloud Platform Specialist - Tx Dell EMC | CPSD Mobile +1-832-372-9280 Loren.Daniel@Dell.com Dell | VMware | Pivotal | EMC | Virtustream | RSA
Reply
0 Kudos
1 Solution

Accepted Solutions
LucD
Leadership
Leadership
Jump to solution

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

View solution in original post

Reply
0 Kudos
4 Replies
LucD
Leadership
Leadership
Jump to solution

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

Reply
0 Kudos
mhhdaniel
Contributor
Contributor
Jump to solution

Is it possible to pass the names from a .csv or .txt file?

Thank you,

Loren

Loren E. Daniel Cloud Platform Specialist - Tx Dell EMC | CPSD Mobile +1-832-372-9280 Loren.Daniel@Dell.com Dell | VMware | Pivotal | EMC | Virtustream | RSA
Reply
0 Kudos
maishsk
Expert
Expert
Jump to solution

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

My Blog - @maishsk

Co-Author of VMware vSphere Design

Maish Saidel-Keesing • @maishsk • http://technodrone.blogspot.com • VMTN Moderator • vExpert • Co-author of VMware vSphere Design
mhhdaniel
Contributor
Contributor
Jump to solution

Thank you both very much this did the trick!

Thanks,

Loren

Loren E. Daniel Cloud Platform Specialist - Tx Dell EMC | CPSD Mobile +1-832-372-9280 Loren.Daniel@Dell.com Dell | VMware | Pivotal | EMC | Virtustream | RSA
Reply
0 Kudos