I've been able to get these 3 x working together thus far. I may comment out the HW portion though.
Original Message:
Sent: Apr 01, 2025 07:18 AM
From: hgdeloitte
Subject: VMWare Tools + HW Upgrade Combined w/reboot at end
Hello Ed.
Unfortunately I cannot help with the script but I would like to provide some insight.
Upgrading a VM's hardware version is not recommended unless there is a specific new feature a VM requires.
https://knowledge.broadcom.com/external/article/315390/upgrading-a-virtual-machine-to-the-lates.html#:~:text=VMware%20does%20not%20recommend%20upgrading,there%20are%20issues%20post%20upgrade.
I see you have -NoReboot in the script. I have been doing upgrade testing of the VMware Tools 12.5.1 version that just came out. I have discovered that a reboot is mandatory. We have versions 12.3.5 and up in our environment and they all have required a reboot. I believe this is because:
- Support for the x86 version of VMware Tools has been deprecated.
- The combination and number of base hardware drivers being upgraded (NIC, Video, SCSI, etc.) require a reboot.
Also, if you have to upgrade MS Visual C++ Redistributable, that also typically requires a reboot.
I don't mean to rain on your parade; just hoping to save you some heartburn.
Thanks.
Original Message:
Sent: Mar 31, 2025 05:17 PM
From: Ed Fraser
Subject: VMWare Tools + HW Upgrade Combined w/reboot at end
@LucD You had helped me a few years back hoping I can capture your help before you leave the community.
Looking to combine this into 1 x fancy script to perform both tasks...
- Grab VM names from a list.
- Flip the HW upgrade bit to upgrade on next restart
- Tell the VM to upgrade tools and reboot
- Loop through 1 x VM at a time from the list
I may have a completely botched script here that I combined so hoping you can assist.
Part 1 works great (tools upgrade). I hadn't tested part 2 as of yet.
$HardwareUpdateVMs = get-vm (Get-Content d:\temp\VMtools_HW.txt) Foreach ($VM in ($HardwareUpdateVMs)) {$VMConfig = Get-View -VIObject $VM.Name$vmConfigSpec = New-Object VMware.Vim.VirtualMachineConfigSpec$vmConfigSpec.ScheduledHardwareUpgradeInfo = New-Object -TypeName VMware.Vim.ScheduledHardwareUpgradeInfo$vmConfigSpec.ScheduledHardwareUpgradeInfo.UpgradePolicy = "always"$vmConfigSpec.ScheduledHardwareUpgradeInfo.VersionKey = "vmx-21"$VMConfig.ReconfigVM($vmConfigSpec)}Foreach ($VM in ($HardwareUpdateVMs)) {% { get-view $_.id } |Where-Object {$_.Guest.ToolsVersionStatus -like "guestToolsNeedUpgrade"} |select name, @{Name="ToolsVersion"; Expression={$_.config.tools.toolsversion}}, @{ Name="ToolStatus"; Expression={$_.Guest.ToolsVersionStatus}}|Update-Tools -NoReboot -VM {$_.Name} -Verbose}