Virtually everything is poshable
PowerCLI: Host Hardware One-Liner
A quick one-liner which gives you an outline of your Host hardware information:
Get-VMHost |Sort Name |Get-View |
Select Name,
@{N=“Type“;E={$_.Hardware.SystemInfo.Vendor+ “ “ + $_.Hardware.SystemInfo.Model}},
@{N=“CPU“;E={“PROC:“ + $_.Hardware.CpuInfo.NumCpuPackages + “ CORES:“ + $_.Hardware.CpuInfo.NumCpuCores + “ MHZ: “ + [math]::round($_.Hardware.CpuInfo.Hz / 1000000, 0)}},
@{N=“MEM“;E={“” + [math]::round($_.Hardware.MemorySize / 1GB, 0) + “ GB“}} | Export-Csv c:\hostinfo.csv
Output Example:
| Name | Type | CPU | MEM |
| prod01.domain.local | Dell Inc. PowerEdge 2950 | PROC: 2 CORES: 8 MHZ: 2993 | 32 GB |
| prod02.domain.local | Dell Inc. PowerEdge 2950 | PROC: 2 CORES: 8 MHZ: 2993 | 32 GB |
| prod03.domain.local | Dell Inc. PowerEdge 2950 | PROC: 2 CORES: 8 MHZ: 2993 | 32 GB |
| prod04.domain.local | Dell Inc. PowerEdge 2950 | PROC: 2 CORES: 4 MHZ: 2993 | 16 GB |
| tst10.domain.local | Dell Inc. PowerEdge 2950 | PROC: 2 CORES: 8 MHZ: 2660 | 16 GB |
| tst11.domain.local | Dell Inc. PowerEdge 2950 | PROC: 2 CORES: 8 MHZ: 2660 | 16 GB |
| tst12.domain.local | Dell Inc. PowerEdge 2950 | PROC: 2 CORES: 8 MHZ: 2660 | 16 GB |
| tst13.domain.local | Dell Inc. PowerEdge 2950 | PROC: 2 CORES: 8 MHZ: 2992 | 32 GB |
| tst14.domain.local | Dell Inc. PowerEdge 2950 | PROC: 2 CORES: 8 MHZ: 2992 | 32 GB |
| tst15.domain.local | Dell Inc. PowerEdge 2950 | PROC: 2 CORES: 8 MHZ: 2992 | 32 GB |
| tst16.domain.local | Dell Inc. PowerEdge 2950 | PROC: 2 CORES: 8 MHZ: 2992 | 32 GB |
| Print article | This entry was posted by Virtu-Al on July 8, 2009 at 12:09, and is filed under PowerCLI, powershell, vmware. Follow any responses to this post through RSS 2.0. You can leave a response or trackback from your own site. |







(3)
(13)
(0)
about 1 year ago
How can I get the datacenter where the hardware resides?
about 1 year ago
@Mark M
Not in front of my VI at the moment but try this:
Get-VMHost |Sort Name |Get-View |
Select @{N=“DataCenter“;E={Get-VMHost $_ | Get-Datacenter}}, Name,
@{N=“Type“;E={$_.Hardware.SystemInfo.Vendor+ “ “ + $_.Hardware.SystemInfo.Model}},
@{N=“CPU“;E={“PROC:“ + $_.Hardware.CpuInfo.NumCpuPackages + “ CORES:“ + $_.Hardware.CpuInfo.NumCpuCores + “ MHZ: “ + [math]::round($_.Hardware.CpuInfo.Hz / 1000000, 0)}},
@{N=“MEM“;E={“” + [math]::round($_.Hardware.MemorySize / 1GB, 0) + “ GB“}} | Export-Csv c:\hostinfo.csv
about 8 months ago
Can we return the hosts hardware serial number too?
about 8 months ago
Unfortunatly the serial number is a bit of a pain as different vendors put it in different places, have you checked Carters CIM script ?
about 1 month ago
Anyone figure out how to get the host’s serial number? I can see it in VC under the hosts’ ‘Hardware Status’ ‘System summary’ information.