VMware Cloud Community
jimm_chen
Contributor
Contributor

How to call Update-Tools -NoReboot if not running/current?

I am trying to come up with a script to loop through the VMs on a particular vcenter to install/update vmware-tools if it's not in "guestToolsCurrent" format, and ideally, to give a confirmation prompt before it runs the Update-Tools function. Tried hacking some pieces of CLI code but not having much success. It would be awesome If someone can help me with a template to work off from.

0 Kudos
1 Reply
RvdNieuwendijk
Leadership
Leadership

You can use something like:

Get-VM | Where-Object {$_.ExtensionData.Guest.ToolsVersionStatus -eq 'guestToolsNeedUpgrade'} | Update-Tools -NoReboot

Unfortunately you cannot use the -Confirm parameter with the Update-Tools cmdlet.

Blog: https://rvdnieuwendijk.com/ | Twitter: @rvdnieuwendijk | Author of: https://www.packtpub.com/virtualization-and-cloud/learning-powercli-second-edition
0 Kudos