VMware Cloud Community
vmk2014
Expert
Expert

Changing Guest OS version from 2012 R2 to OS 2016 in VC Summary tab

Hi All,

While pulling the RV tools report it pulls the information from Windows 2012 R2 as 2012 R though the VM is running with OS version 2016. In order to fix this each VM we need to change the option from VM edit setting --> VM option to OS 2016 but to apply the changes we need to unregister the VM's from inventory and add back to inventory which requires downtime.

We have around 800 VM's as windows 2016 but rvtools shows Windows 2012 R2 based on VC summary tab.  We want to fix this from power cli. Screenshot attached.

It seems earlier VC 5.5 was not having for OS 2016 deployment.  Any help will be much appreciated.

thanks

vmk

Tags (1)
0 Kudos
20 Replies
LucD
Leadership
Leadership

The value you see is the value you spcify when the VM is created.
There is in fact no obligation to actually install that guest OS on the VM.

Do you have VMware Tools installed on those VM?

If yes, you can obtain the guest OS version as obtained by the VMware Tools.
That value reflects the actual guest OS version.
The folowing snippet shows both values.

Get-VM |

Select Name,

   @{N='OSConfig';E={$_.ExtensionData.Config.GuestFullName}},

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

Do you in fact want to change the content of the CSV file created by RvTools?


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

0 Kudos
vmk2014
Expert
Expert

LucD,

First of all, I would like to say thank you for responding to my query. 

Do you have VMware Tools installed on those VM?  -Yes.

Its appears that VC 5.5 was not having an option for 2016 OS while creating the VM's and whenever pull the report for OS, 2016 OS always shows as Windows 2012 R2 and even in summary tab.

This makes our calculation wrong. Even in the Summary tab of Guest os shows 2012 R2 through the OS installed is Windows 2016. I'm looking to fix through power cli if possible instead of visiting each VM's and changing the VMX file through the edit setting and then adding back to inventory which fixes the issues. It seems to remove and add back the VM to inventory updates VCSA DB as per my understanding..

thanks

vmk

0 Kudos
LucD
Leadership
Leadership

I'm not sure I'm understanding what you are trying to do with unregistering/registering the VM.
Doing that alone will not update the GuestId you specified when you created the VM.


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

0 Kudos
vmk2014
Expert
Expert

LucD,

Once, I change the VM guest OS from VMotion option from edit setting then the changes don't take place until I remove the VM's from inventory and add back from data store i.e. vmx file.

After following all these steps then it will reflect the correct OS in VC summary tab for Gues OS. Hope I am able to explain to you.   Let me know if you have any questions.

pastedImage_0.png

Thanks

vmk

0 Kudos
LucD
Leadership
Leadership

Not sure I'm following.
Where do you change the GuestId during a vMotion?


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

0 Kudos
vmk2014
Expert
Expert

Ok, I'm not doing any vmotion. I'm just editing the VM properties and then go to VM option, you will see Guest OS  and Guest OS version then we can the Guest OS version as per requirement.

Here i changed to Windows 2016 but after adding back to inventory, it started showing correct OS version in VC summary tab of the VM's.

Let me know if you were able to understand. We need to fix around 800 VM's

0 Kudos
LucD
Leadership
Leadership

No, not really.
The option you are describing is disabled (grayed out) when the VM is powered on.


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

0 Kudos
vmk2014
Expert
Expert

You are right, we need to power off the VM first. Sorry about that

0 Kudos
LucD
Leadership
Leadership

But then you don't need this unregister/register at all.
You could just do (for a powered off VM)

Get-VM |

where{$_.GuestId -eq 'windows8Server64Guest'} |

Set-VM -GuestId 'windows9Server64Guest' -Confirm:$false


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

0 Kudos
vmk2014
Expert
Expert

LucD,

Can we do this for bulk VM's from text file C: \temp\vmlist.txt?  I  understand that we need to power off the VM's first to fix this issue.

Thanks

vmk

0 Kudos
LucD
Leadership
Leadership

Yes, the VM needs to be powered off for this to work.
To read the VM names from a .txt file, and to stop the VMs, and wait till they are stopped, and then start the VMs again, is similar to what was done for changing the HW version of the VMs.


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

0 Kudos
vmk2014
Expert
Expert

LucD,

Yes, we have around 800 VM's showing the wrong OS in the summary tab of VC, hence want to change in bulk.

Thanks

vmk

0 Kudos
LucD
Leadership
Leadership

Yes, but didn't we do that same exercise for upgrading the VM's HW version?
Are we going to repeat that complete exercise here, or can you reuse that logic?


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

0 Kudos
vmk2014
Expert
Expert

LucD,

sorry for the confusion. I'm not asking for VM HW version upgrade but  Guest OS version upgrade in the summary tab of the VM.

thanks

vmk

0 Kudos
LucD
Leadership
Leadership

I know, but what I'm trying to explain is that the complete flow resembles the one we did some time ago for upgrading the HW version.

Reading the VMs from a .txt file, stopping the VMs, making the change, starting the VMs..

My question is, can't you reuse that logic, and instead of doing the HW version upgrade, do the GuestId change.

And not go through all these same steps here again.


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

0 Kudos
vmk2014
Expert
Expert

Sounds good. yes, I will use the same logic here.

Get-VM |

where{$_.GuestId -eq 'windows8Server64Guest'} |

Set-VM -GuestId 'windows9Server64Guest' -Confirm:$false

foreach($vmName in (Get-Content -Path C:\TEMP\vmliste.txt)){

    $vm = Get-VM -Name $vmName

    $vm.ExtensionData.ReconfigVM_Task($do)

}

0 Kudos
LucD
Leadership
Leadership

0 Kudos
LucD
Leadership
Leadership

I think you might be mixing some snippets here.

The nucleus of the script should probably be

Get-VM -Name (Get-Content -Path C:\TEMP\vmliste.txt) |

where{$_.GuestId -eq 'windows8Server64Guest'} |

Set-VM -GuestId 'windows9Server64Guest' -Confirm:$false


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

0 Kudos
vmk2014
Expert
Expert

Thank you, LucD. I lost the links. Will test the script on Test VM's first and will update.

thanks

vmk

0 Kudos