param( [Parameter(Mandatory)] [string]$Path ) $inventory = Import-Clixml $Path $computer = $inventory.ComputerInfo $roles = $inventory.OSInfo.WindowsFeatures $services = @($inventory.HyperV.Services) $vms = @($inventory.VirtualMachines) $nics = @($inventory.Network.NetAdapters) $mgmtNics = @($inventory.Network.ManagementOSAdapters) $switches = @($inventory.Network.VMSwitches) $volumes = @($inventory.Storage.Volumes) Write-Host "`n### Hyper-V Host Summary ###" [pscustomobject]@{ # OS / Host ComputerName = $inventory.OSInfo.ComputerName OperatingSystem = $inventory.OSInfo.OperatingSystem OSBuild = $inventory.OSInfo.OSBuild CollectedAt = $inventory.CollectedAt.DateTime # ComputerInfo Manufacturer = $computer.CsManufacturer Model = $computer.CsModel Processor = $computer.CsProcessors.Name PhysicalProcessors = @($computer.CsProcessors).Count LogicalProcessors = $computer.CsNumberOfLogicalProcessors NUMANodes = @($inventory.NumaNodes).Count MemoryGB = [math]::Round( $computer.CsTotalPhysicalMemory / 1GB, 1 ) BIOSVersion = $computer.BiosSMBIOSBIOSVersion # Cluster ClusterName = $inventory.OSInfo.ClusterName # Role and Features InstalledRoles = ($roles | Where-Object {$_.Installed -and $_.FeatureType -like 'Role*'}).Count InstalledFeatures = ($roles | Where-Object {$_.Installed -and $_.FeatureType -like 'Feature*'}).Count # Services HyperVServices = $services.Count RunningServices = @($services | Where-Object Status -like 'Running' ).Count # VM VMCount = $vms.Count RunningVMs = @($vms | Where-Object State -like 'Running').Count StoppedVMs = @($vms | Where-Object State -like 'Off').Count HAVMs = @($vms | Where-Object HA -eq $true).Count # Network NetAdapters = $nics.Count UpNetAdapters = @($nics | Where-Object Status -like 'Up').Count ManagementOSNICs = $mgmtNics.Count VMSwitches = $switches.Count # Storage Volumes = $volumes.Count } Write-Host "`n### WindowsFeatures (Get-WindowsFeature) ###" $roles | Where-Object {$_.Installed} | Format-Table -AutoSize Write-Host "`n### Services (Get-Service) ###" $services | Format-Table Name, Status, StartType Write-Host "`n=== VMHost (Get-VMHost) ===" $inventory.HyperV.VMHost | Select LogicalProcessorCount, NumaSpanningEnabled, MemoryCapacity, VirtualMachineMigrationEnabled,VirtualHardDiskPath, VirtualMachinePath | Format-List Write-Host "`n### Virtual Machines (Get-VM) ###" $vms | Select-Object Name, State, Generation, ProcessorCount, HA | Format-Table -AutoSize Write-Host "`n=== VMReplicationServer (Get-VMReplicationServer) ===" $inventory.HyperV.VMReplicationServer | Format-Table -AutoSize Write-Host "`n=== VMReplication (Get-VMReplication) ===" $inventory.HyperV.VMReplication | Format-Table -AutoSize Write-Host "`n### Network ###" Write-Host "`n=== NetAdapters (Get-NetAdapter) ===" $nics | Select-Object Name, Status, LinkSpeed | Format-Table -AutoSize Write-Host "`n=== VMSwitches (Get-VMSwitch) ===" $switches | Select Name,SwitchType,AllowManagementOS,EmbeddedTeamingEnabled,AllowNetLbfoTeams | Format-Table -AutoSize Write-Host "`n=== IPAddresses (Get-NetIPConfiguration) ===" $inventory.Network.IPAddresses | ForEach-Object { [pscustomobject]@{ IfAlias = $_.InterfaceAlias IfIndex = $_.InterfaceIndex MacAddress = $_.NetAdapter.MacAddress IPv4Address = @( $_.IPv4Address | ForEach-Object { [pscustomobject]@{ IPAddress = $_.IPAddress PrefixLength = $_.PrefixLength } } ) IPv6Address = @( $_.IPv6Address | ForEach-Object { [pscustomobject]@{ IPAddress = $_.IPAddress PrefixLength = $_.PrefixLength } } ) IPv4Gateway = @( $_.IPv4DefaultGateway.NextHop ) IPv6Gateway = @( $_.IPv6DefaultGateway.NextHop ) DNSServer = @( $_.DNSServer.ServerAddresses ) } } | Select-Object IfAlias,IfIndex, MacAddress, @{N='IPv4Address';E={ ($_.IPv4Address | ForEach-Object { "$($_.IPAddress)/$($_.PrefixLength)" }) -join ', ' }} |Format-Table -AutoSize Write-Host "`n### Storage ###" Write-Host "`n=== Volumes (Get-Volume) ===" $volumes | Select-Object DriveLetter, FileSystemLabel, @{N='SizeGB';E={[math]::Round($_.Size / 1GB,1)}}, @{N='FreeGB';E={[math]::Round($_.SizeRemaining / 1GB,1)}} | Format-Table -AutoSize Write-Host "`n=== PhysicalDisks (Get-PhysicalDisk) ===" $inventory.Storage.PhysicalDisks | Format-Table -AutoSize Write-Host "`n=== ClusterSharedVolumes (Get-ClusterSharedVolume) ===" $inventory.Storage.ClusterSharedVolumes |Select Name, OwnerNode, State, @{Name='Path'; Expression={$_.SharedVolumeInfo.FriendlyVolumeName}} | Format-Table -AutoSize Write-Host "`n=== S2D.StoragePools (Get-StoragePool) ===" $inventory.Storage.S2D.StoragePools|Format-Table -AutoSize Write-Host "`n=== S2D.PhysicalDisks (Get-PhysicalDisk) ===" $inventory.Storage.S2D.PhysicalDisks|Format-Table -AutoSize Write-Host "`n=== S2D.VirtualDisks (Get-VirtualDisk) ===" $inventory.Storage.S2D.VirtualDisks|Format-Table -AutoSize Write-Host "`n### EventLog (Get-WinEvent, Critical/Error in the past 24h) ###" $Inventory.HyperVEvents | Where-Object LevelDisplayName -in '重大','エラー' | Group-Object LogName | ForEach-Object { Write-Host "`n=== $($_.Name) ===" $_.Group | Sort-Object TimeCreated -Descending | Format-Table TimeCreated, Id, LevelDisplayName, Message -AutoSize -Wrap }