Monitoring Hyper-V utilization and performance
This report gathers information about a Hyper-V server and the VMs running on that server.
Getting ready
You run this recipe on the HV1
Hyper-V host.
How to do it...
- Create a basic report hash table:
$ReportHT = [Ordered] @{}
- Get the host details and add them to the report hash table:
$HostDetails = Get-CimInstance -ClassName Win32_ComputerSystem $ReportHT.HostName = $HostDetails.Name $ReportHT.Maker = $HostDetails.Manufacturer $ReportHT.Model = $HostDetails.Model
- Add the PowerShell version information to the report hash table:
$ReportHT.PSVersion = $PSVersionTable.PSVersion.ToString()
- Add OS information to the report hash table:
$OS = Get-CimInstance -Class Win32_OperatingSystem $ReportHT.OSEdition = $OS.Caption ...
Get Windows Server 2019 Automation with PowerShell Cookbook - Third Edition now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.