Hi
I would like to get a list of all VirtualMachineGuestOsIdentifier within PowerCLI.
Smth like this:
I tried this:
(get-vm | get-vmguest).GuestID | sort | unique
This Shows all IDs but only from existing VMs, but i want all of it 🙂
I am trying to get the list over the Type "GuestID", but I am not able to do it.
With this line i'm getting the TypeName:
Get-Vm <servername> | get-vmguest | get-member guestid
=> TypeName: VMware.VimAutomation.ViCore.Impl.V1.VM.Guest.VMGuestImpl
Now, I have no idea how to go further from this.
Can you please help me? Or is there a better way?
Thank you very much
If you're at least on PowerShell v3, you can do
[VMware.Vim.VirtualMachineGuestOsIdentifier].GetEnumValues()
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
If you're at least on PowerShell v3, you can do
[VMware.Vim.VirtualMachineGuestOsIdentifier].GetEnumValues()
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
Hi LucD
Thank you very much, exactly what I was looking for
How did you find out this [VMware.Vim.VirtualMachineGuestOsIdentifier] ?
Is there also a way to get the FullName?
The API Reference and some PowerShell/.Net knowledge.
In a VirtualMachine object, this OS id is stored in the VirtualMachineConfigInfo object under the guestId property.
The API Reference tells me that the property contains a value from the VirtualMachineGuestOsIdentifier enumeration.
In the PowerCLI framework these enumerations are mapped.
From within PowerShell you can get all values for an enumeration with the GetEnumValues method, which is defined on the System.Type since .Net4
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
thank you for the Explanation, I understand now, how it works.
I can see the Property guestFullName from the Object "VirtualMachineConfigInfo".
But this Property does not contain any enumerations, am I right?
Is there another way to get the description for this enumeration VirtualMachineGuestOsIdentifier ?
That is correct.
The value for guestFullName is obtained via the VMware Tools from within the guest OS.
For vSphere that is just a [string], no enumeration.
Not sure what you mean with that last question ?
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
I would like to have the VirtualMachineGuestOsIdentifier but also the descripton of the ID within PowerCLI.
As an example, I want this Info: windows7Server64Guest => Windows Server 2008 R2 (64 bit)
And this for each OSIdentifier.
Hope it's clear now
Thx for your time
I'm afraid there is no enumeration for that property.
It's a string that comes from within the guest OS, obtained through the VMware Tools.
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
Ok, what a pity
Thank you very much for your help
$viObjVmHost = Get-VMHost -Name "whatever"
$viewObjEnvBrowser = Get-View -Id (Get-View -Id $viObjVmHost.ExtensionData.Parent).EnvironmentBrowser
$vmxVer = ($viewObjEnvBrowser.QueryConfigOptionDescriptor() | Where-Object {$_.DefaultConfigOption}).Key
$osDesc = $viewObjEnvBrowser.QueryConfigOption($vmxVer,$viObjVmHost.ExtensionData.MoRef).GuestOSDescriptor
Maybe that will give you what you are seeking. It is based on a given host and VM version. I believe it is what gets used by the GUI when deploying a new VM.
Wow, perfect! You are a genius
It works like a charm 🙂
Thank you both for the great support
Thank you so much, Perfect answer