Files
Sandbox/VMware-HostInventory.ps1
Zack Meier 03dba08135 sync
2026-04-15 15:42:41 -05:00

36 lines
1.3 KiB
PowerShell

$iLOs = Find-HPEiLO -Range "10.8.144.0-255"
$iLOs += Find-HPEiLO -Range "10.8.145.0-255"
$iLOs += Find-HPEiLO -Range "10.8.146.0-255"
$iLOs += Find-HPEiLO -Range "10.8.147.0-255"
$iLOs += Find-HPEiLO -Range "10.8.148.0-255"
$iLOs += Find-HPEiLO -Range "10.8.149.0-255"
$iLOs += Find-HPEiLO -Range "10.8.150.0-255"
$iLOs += Find-HPEiLO -Range "10.8.151.0-255"
$iLOs = Find-HPEiLO -Range "10.8.144-151" -Full
$ilos | export-csv "D:\OneDrive - State of North Dakota\iLOs.csv"
$Connection = $iLOs | Connect-HPEiLO -Credential $AdminCred
$AllTags = Get-HPEiLOAssetTag -Connection $Connection
$result = @()
ForEach($ilo in $iLOs)
{
$Hostname = $ilo.hostname -replace 'lo'
$VMhost = Get-VMhost $Hostname
$obj=[PSCustomObject]@{
Hostname = $Hostname;
IPAddress = (Resolve-DNSName $Hostname).IPAddress
Model = $iLO.HostSystemInformation.SPN;
SerialNumber = $iLO.HostSystemInformation.SerialNumber;
AssetTag = ($AllTags | where-object Hostname -eq $iLO.Hostname).AssetTag;
Rack = $ilo.BladeSystem.Manager.Rack;
Enclosure = $ilo.BladeSystem.Manager.Enclosure;
Bay = $ilo.BladeSystem.Bay;
CPU = $VMhost.NumCpu;
Memory = [math]::round($VMhost.MemoryTotalGB,2);
Cluster = ($VMHost | Get-Cluster).Name;
}
$result += $obj
}