Skip to content
Menu
The Lonely Administrator
  • PowerShell Tips & Tricks
  • Books & Training
  • Essential PowerShell Learning Resources
  • Privacy Policy
  • About Me
The Lonely Administrator

My PowerShell Hyper-V Health Report

Posted on December 5, 2019December 5, 2019

Over the last few years I've been using and tweaking a PowerShell script that generates an HTML report that provides information about a Hyper-V host and running virtual machines. This is another great use case for a PowerShell control script. The script helps me organize commands like Get-CimInstance, Get-VM and Get-Counter to retrieve pieces of data and pull them all together into an HTML report.

Manage and Report Active Directory, Exchange and Microsoft 365 with
ManageEngine ADManager Plus - Download Free Trial

Exclusive offer on ADManager Plus for US and UK regions. Claim now!

The script accepts parameters and has comment-based help.

image

This version of the script does not require anything to be installed locally, not even the Hyper-V cmdlets. The script uses PowerShell remoting and gathers all the information from a Hyper-V host that you specify. If necessary, you can use alternate credentials. If you are like me and use Hyper-V on Windows 10, the Computername parameter defaults to the localhost.

The script gathers a wide range of information and creates HTML fragments. At the end of the script, a file is created locally. The script embeds the CSS style sheet as well as any logo graphic you might specify. This makes the file completely portable, say if you wanted to email it with Send-MailMessage or something similar.

Here are a few script features:

  • Collapsible regions
  • Performance Counters
  • Resource Metering reporting
  • Replication reporting
  • Find virtual machines created in last X number of days (default 30)
  • Find virtual machines not used in X number of days (default 30

Currently, the script only supports WSMan remoting so you must have a Windows client. Although PowerShell 7 should work just fine. At some point I might add SSH support so you can run this from a non-Windows client.

Here's a sample report. The collapsible regions may not work in this display or every browser.

You can find the complete script on GitHub.

Be sure to test this script in a non-production setting. It is only getting information but still, you want to make sure the script does what you think it is going to do.  If you have questions or comments I'd love to hear them.


Behind the PowerShell Pipeline

Share this:

  • Click to share on X (Opens in new window) X
  • Click to share on Facebook (Opens in new window) Facebook
  • Click to share on Mastodon (Opens in new window) Mastodon
  • Click to share on LinkedIn (Opens in new window) LinkedIn
  • Click to share on Pocket (Opens in new window) Pocket
  • Click to share on Reddit (Opens in new window) Reddit
  • Click to print (Opens in new window) Print
  • Click to email a link to a friend (Opens in new window) Email

Like this:

Like Loading...

Related

reports

Powered by Buttondown.

Join me on Mastodon

The PowerShell Practice Primer
Learn PowerShell in a Month of Lunches Fourth edition


Get More PowerShell Books

Other Online Content

github



PluralSightAuthor

Active Directory ADSI Automation Backup Books CIM CLI conferences console Friday Fun FridayFun Function functions Get-WMIObject GitHub hashtable HTML Hyper-V Iron Scripter ISE Measure-Object module modules MrRoboto new-object objects Out-Gridview Pipeline PowerShell PowerShell ISE Profile prompt Registry Regular Expressions remoting SAPIEN ScriptBlock Scripting Techmentor Training VBScript WMI WPF Write-Host xml

©2025 The Lonely Administrator | Powered by SuperbThemes!
%d