VMware Cloud Community
johnjohnjjj
Contributor
Contributor

how to show the network info for a server + number of processors using Get-VMHost command

I run the following powercli 5.5 command , to get info about a host vm :-

Get-VMHost |Export-Csv -Path c:\VM.csv -NoTypeInformation UseCulture

and I got these info :-

State   ConnectionState PowerState  VMSwapfileDatastoreId   VMSwapfilePolicy   ParentId   IsStandalone   Manufacturer   Model   NumCpu  CpuTotalMhz CpuUsageMhz LicenseKey  MemoryTotalMB   MemoryTotalGB   MemoryUsageMB   MemoryUsageGB   ProcessorType   HyperthreadingActive   TimeZone   Version Build   Parent  VMSwapfileDatastore StorageInfo NetworkInfo DiagnosticPartition FirewallDefaultPolicy   ApiVersion  Name   CustomFields   ExtensionData   Id  Uid Connected   Connected   PoweredOn   WithVM  Folder-ha-folder-host TRUE HP  ProLiant DL365 G5  8   18400   1402   5M230-08JDM-J8R41-05NH4-2DR3N   16381.85547 15.99790573 13184   12.875  Quad-Core AMD Opteron(tm) Processor 2356  FALSE UTC 5.0.0   623860  host  HostStorageSystem-storageSystem localhost:  mpx.vmhba1:C0:T0:L0 VMHostFirewallDefaultPolicy:HostSystem-ha-host  5   172***.101  VMware.VimAutomation.ViCore.Impl.V1.Util.ReadOnlyDictionary`2[System.String,System.String] VMware.Vim.HostSystem HostSystem-ha-host /VIServer=root@***:443/VMHost=HostSystem-ha-host/

But I have these 2 questions:-

  • under the networkinfo column I got the following "localhost:" instead of getting the host ip, mac, et.. so what is causing the Networkinf to not show the actual network info ?
  • for the NumCpu column I got 8, which is the number of cores in our case. as in our case we have 2 processes with 4 cores on each processor. so my question is how I can get the number of processes (2 in our case) instead of getting the number of cores ?is this possible ?
0 Kudos
4 Replies
schepp
Leadership
Leadership

Hi,

What IP and MAC are you searching for?

Your host has multiple (vmk0,vmk1, etc.)

You will see them with

Get-VMHost | Get-VMHostNetwork

The Number of CPUs is hidden in

(Get-VMhost).ExtensionData.Hardware.CpuInfo.NumCpuPackages

Tim

0 Kudos
LucD
Leadership
Leadership

The NetworkInfo property is in fact another object of the type VMHostNetworkInfo

Most of the information you want to see is in there, but Export-Csv does not know how to expand that object when exporting it to a CSV file.

So you get the default way this type of object is displayed, you get the hostname, which in your case seems to be "localhost".

You can get at the information inside the nested object by using calculated properties, for example:

Get-VMHost |

Select Name,

    @{N='HostName';E={$_.NetworkInfo.HostName}}


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

0 Kudos
johnjohnjjj
Contributor
Contributor

The Number of CPUs is hidden in

(Get-VMhost).ExtensionData.Hardware.CpuInfo.NumCpuPackages


so in this case how i can show it ?

0 Kudos
LucD
Leadership
Leadership

Like this

Get-VMHost |

Select Name,

    @{N='NumCpu';E={$_.ExtensionData.Hardware.CpuInfo.NumCpuPackages}}


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

0 Kudos