Hello,
I have many VMs (VM names saved in the txt file located in: 'D:\OSList\VMs.txt' that has the incorrect Guest OS version and I would like to change it to the correct one.
Example:
Microsoft Windows Server 2008 R2 (64bit) to Microsoft Windows Server 2012 (64bit)
Microsoft Windows Server 2012 (64bit) to Microsoft Windows Server 2008 R2 (64bit)
Microsoft Windows Server 2012 (64bit) to Microsoft Windows Server 2016 or later (64bit)
Microsoft Windows Server 2016 or later (64bit) to Microsoft Windows Server 2012 (64bit)
Can anyone please help me to update the Guest OS version via script?
The OSVersion reported under Guest is obtained by the VMware Tools.
You can't change that.
But are you sure you are looking at the Guest property?
The VMware Tools normally report the correct value
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
What I meant is:
For example, The actual OS is Win 2012 and yes VMware tools report it is as Win 2012. But the VM is configured with 2016. In this case what we have to do is:
1. Power of the VM
2. Edit settings and select VM Options and then change the Guest OS Version:
So here I am looking a script that I can achieve the above steps . Can you please help ?
You can change that, provided the HW version of the VM supports it, with the Set-VM cmdlet and the GuestId parameter.
The GuestId parameter takes values defined in VirtualMachineGuestOsIdentifier, but again only if the HW version of the VM supports it.
Your table should contain those GuestID values in the two columns, not the full OS name.
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
Thank you for the reply. But I am a beginner in scripting and not sure how to write the script with the provided information, sorry. Is there anyway you can give me a sample ?
A simple search in here should allow you to find many examples.
For example this thread How to change OSFullName, GuestId, RunTimeGuestID using powercli
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
Hello,
Thank you. That works.
But I dont see the 'Enum Constants' for 2008, 2012 and 2016 servers ? Do you know where can I find that ?