PowerCLI

 View Only
  • 1.  Updating VMWare tools on all Windows VM's

    Posted Jun 13, 2011 12:09 AM

    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



  • 2.  RE: Updating VMWare tools on all Windows VM's
    Best Answer

    Posted Jun 13, 2011 12:25 AM

    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


  • 3.  RE: Updating VMWare tools on all Windows VM's

    Posted Jun 13, 2011 03:25 AM

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

    Thank you,

    Loren



  • 4.  RE: Updating VMWare tools on all Windows VM's

    Posted Jun 13, 2011 05:51 AM

    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



  • 5.  RE: Updating VMWare tools on all Windows VM's

    Posted Jun 13, 2011 06:05 AM

    Thank you both very much this did the trick!

    Thanks,

    Loren