VMware Cloud Community
MatthewFB
Enthusiast
Enthusiast

Guest OS Version - Update to match OS according to VMware Tools - with out an immediate power down?

Hello everyone,

Trying to clean up our environment we have numerous VMs to which the Guest OS Version choosen differs from the installed OS version. Now, i know this is purely cosmetic and updating the Guest OS Version will not change anything relating to the installed VM, or give it access to any newer features/options a new OS version would have on a clean installed VM.

Aside from the GUI method, which with the volume of VM's, would take some time to schedule an outage for them all, to power down and change, is there a way to do it via PowerCLI, but the catch...

My thought being, is there a method to Get-VM where Guest OS Version (configuration file) is not equal to VMware tools detected OS then update VM. Then, hold that config until the next time the VM is rebooted to change it?

Hope being that we could tie this into a windows update period to minimize reboots and outage windows versus shutdown a single VM, change in GUI, power on VM over about 100+ times..

5 Replies
scott28tt
VMware Employee
VMware Employee

Moderator: Moved to PowerCLI


-------------------------------------------------------------------------------------------------------------------------------------------------------------

Although I am a VMware employee I contribute to VMware Communities voluntarily (ie. not in any official capacity)
VMware Training & Certification blog
LucD
Leadership
Leadership

I would suggest to first get a lay of the field with

Get-VM |

Select Name,

    @{N='OSFullName';E={$_.Guest.OSFullName}},

    @{N='GuestID';E={$_.Guest.ConfiguredGuestId}}

The reason being that you will need to have some logic to select the correct GuestId.

Once that is available, could be a hash table, you can use the Set-VM cmdlet with the GuestId parameter to change the value.

Afaik, this does not force a reboot.


Blog: lucd.info  Twitter: @LucD22  Co-author PowerCLI Reference

MatthewFB
Enthusiast
Enthusiast

Thank you LucD​ for getting me in the right direction, I will go from here and see how far I make it, I will likely be back asking some simple questions I am sure!

0 Kudos
rlinux1
Contributor
Contributor

I was just looking at doing this, we are converting a bunch of CentOS systems to RHEL, but the it shows up as CentOS still. Did you make any headway on this idea?

Edit: This bit works, but couldn't get it to work without it being off. I have a feeling that is going to be the case no matter what, but wondering if anyone has a work around.

get-vm -name namehere | set-vm -guestid rhel8_64Guest -confirm:$false

0 Kudos
philiaagape
Contributor
Contributor

When my VM was built, I selected the RHEL 6 option because I was using CentOS 6. At some point the VM was reinstalled as CentOS 7, but $_.Guest.ConfiguredGuestId and $_.Guest.OSFullName are still reporting "rhel6_64Guest" and "Red Hat Enterprise Linux 6 (64-bit)" respectively.

I know that VMware Tools can sometimes update this info based on the current running VM. I've seen it work on a Windows box. A Windows VM was installed as Windows 7, then later reinstalled as Windows 10, and the field updated automatically. It's the same VM, we just reinstalled it by attaching an ISO for Windows 10 and reformatting/reinstalling it, and then reinstalling VMware Tools.

So my question is, is there a way to query the information that VMware Tools can see from within the guest OS? Or is there a way to trigger an update of the data reported by Get-VM and the $_.Guest fields?

I wanted to add that I've tried asking ChatGPT, and it doesn't seem to know of a way to query VMware Tools directly... all the solutions it gives me report the same old RHEL 6 info.

0 Kudos