Retrieve list of VMs by OS version using PowerCLI
search cancel

Retrieve list of VMs by OS version using PowerCLI

book

Article ID: 385580

calendar_today

Updated On:

Products

VMware vCenter Server

Issue/Introduction

Data gathering of VM Operating Systems, useful for current status and upgrade path next steps.

Environment

VMware vCenter Server 7.0
VMware vCenter Server 8.0

Cause

With PowerCLI, you can generate all sorts of lists. To retrieve the configured and reported OS version of your VMs, try running this

Resolution

Get-VM | Sort | 
   Get-View -Property @("Name", "Config.GuestFullName", "Guest.GuestFullName", "Guest.IpAddress") | 
   Select -Property Name, 
       @{N="Configured OS";E={$_.Config.GuestFullName}},
       @{N="Running OS";E={$_.Guest.GuestFullName}},
       @{N="IP Address";E={@($_.Guest.IpAddress)}} | 
   Export-CSV -Delimiter ";" -Path "vms.csv"

 

1) If the VMs are not showing the correct Guest OS, please update VMware Tools.

If after VMware Tools is upgraded and the VM is still not showing the correct Operating System, please do the following

 

Shutdown the VM, then Edit Settings. Go to the VM Options tab and expand General Options. There you can set the Guest OS Version via a drop down list selection.

VMware Tools will attempt to update automatically.

 

2) You may also try vMotioning the VM to another host and then try running the PowerCLI command again to see if the Guest OS appears correctly.

3) If the VM Guest OS appears correct in the vSphere client, then you may just need to reboot the ESXi host that the VM is on for the information to refresh correctly.

Additional Information