VMware Cloud Community
akioichiban23
Contributor
Contributor
Jump to solution

PowerCLI guest os version

I am trying to get the CentOS Version by PowerCLI.

I am using this cmdlt:

Get-VM | Select-Object @{N="Name";E={$_.Guest.VM}},@{N="OS";E={$_.Guest.OSFullName}} | Format-Table

It works perfect for Windows Server, but CentOS Server shows 「CentOS 4/5/6/7 (64bit)」

I want to have which version the CentOS is running on.

Does anyone know how to do it or if it is even possible...

Reply
0 Kudos
1 Solution

Accepted Solutions
LucD
Leadership
Leadership
Jump to solution

There  are 3 ways of getting the OS:

  • the OS you specified when you created the VM. This one is highly unreliable since you could for example install a Windows OS on a VM that you defined with a Linux OS
  • through the VMware Tools, which must be installed for this to work. The info is under the $vm.Guest property, i.e. $vm.Guest.OSFullName
  • by querying inside the guest OS with the Invoke-VMScript cmdlet. This is the most reliable method imho.

For your CentOS VM, I would first check the $vm.Guest.OSFullName property, provided VMware Tools are installed.


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

View solution in original post

Reply
0 Kudos
4 Replies
LucD
Leadership
Leadership
Jump to solution

There  are 3 ways of getting the OS:

  • the OS you specified when you created the VM. This one is highly unreliable since you could for example install a Windows OS on a VM that you defined with a Linux OS
  • through the VMware Tools, which must be installed for this to work. The info is under the $vm.Guest property, i.e. $vm.Guest.OSFullName
  • by querying inside the guest OS with the Invoke-VMScript cmdlet. This is the most reliable method imho.

For your CentOS VM, I would first check the $vm.Guest.OSFullName property, provided VMware Tools are installed.


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

Reply
0 Kudos
akioichiban23
Contributor
Contributor
Jump to solution

Thank you LucD,

the Invoke-VMScript worked for me.

searching how to do it took me so long, but your

advice took me only few minutes to get the answer

big help, thank you

Reply
0 Kudos
knvinod1
Contributor
Contributor
Jump to solution

LucD,

$vm.Guest.OSFullName seems stopped pulling the data, we use 6.0 u3d version and its VM HW and latest VM tools running.

Reply
0 Kudos
LucD
Leadership
Leadership
Jump to solution

For all VMs, or just some of them?


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

Reply
0 Kudos