25 lines
978 B
PowerShell
25 lines
978 B
PowerShell
$AllVMHosts = Get-VMHost
|
|
|
|
$Result = [System.Collections.ArrayList]@()
|
|
|
|
ForEach($VMHost in $AllVMHosts){
|
|
$EsxCli = $VMHost | Get-EsxCli -V2
|
|
|
|
$obj = [PSCustomObject]@{
|
|
Name = $VMHost.Name;
|
|
SerialNumber = $EsxCli.hardware.platform.get.Invoke().SerialNumber;
|
|
AssetNumber = ($VMhost.ExtensionData.Summary.Hardware.OtherIdentifyingInfo | select IdentifierValue,@{n='Label';e={$_.IdentifierType.Label}} | where-object Label -eq "Asset Tag")."Asset Tag";
|
|
Model = $VMHost.Model;
|
|
CPU = $VMHost.ProcessorType;
|
|
CPU_ClockGHz = $VMHost.ProcessorType.split('@ ')[1] -replace 'GHz';
|
|
CPU_Sockets = $VMHost.Extensiondata.Summary.Hardware.NumCpuPkgs;
|
|
CPU_TotalCores = $VMHost.Extensiondata.Summary.Hardware.NumCpuCores;
|
|
MemoryTotalGB = $VMHost.MemoryTotalGB
|
|
Location = '';
|
|
Enclosure = '';
|
|
}
|
|
|
|
$null = $Result.Add($obj)
|
|
}
|
|
|
|
$Result | Export-Csv "C:\users\zmeier\desktop\hostinventory.csv" |