Have you ever wanted to create a real-time IT dashboard for your Hyper-V environment? It can be difficult to monitor and assess resources in large Hyper-V environments. On top of that, reporting is essential for IT managers but you cannot provide a basic Excel report. Using Windows PowerShell, you could be able to create reports and dashboards to display virtualization inventory, capacity and general resource availability in your Hyper-V Environment. However, Windows PowerShell can be complex, and there is a tool called ‘PowerShell Universal Dashboard’ or ‘PoshUD’ that was officially released by Adam Driscoll (Microsoft MVP) to assist with this.

Table of Contents

  1. What is PowerShell Universal Dashboard?
  2. How to Use PoshUD?
  3. PoshUD in Docker
  4. PoshUD with VMware?
  5. Resource Metering in Hyper-V
  6. Hyper-V Reporting
  7. Useful Links about PoshUD
  8. Conclusion

Protect Your Data with BDRSuite

Cost-Effective Backup Solution for VMs, Servers, Endpoints, Cloud VMs & SaaS applications. Supports On-Premise, Remote, Hybrid and Cloud Backup, including Disaster Recovery, Ransomware Defense & more!

What is PowerShell Universal Dashboard?

The PowerShell Universal Dashboard PowerShell module allows for creation of web-based dashboards even if you do not have a lot of scripting skills. The module is cross-platform and will run anywhere PowerShell Core can run. Below is a PoshUD dashboard that you can easily run to get essential information about your Hyper-V server.

You can download this dashboard from the following GitHub repository:
https://github.com/ironmansoftware/universal-dashboard/blob/master/examples/server-performance-dashboard.ps1

Download Banner

How to Use PoshUD?

Universal Dashboard is built on ASP.NET Core, PowerShell Core, ReactJS and some JavaScript libraries but you do not need to learn JavaScript, CSS, HTML or C#. You just have to use PowerShell to produce a dashboard.

To install Universal Dashboard Community Edition, you can use the following PowerShell command:

PS> Install-Module -Name UniversalDashboard.Community -AcceptLicense

How to create Hyper-V Dashboard using Windows PowerShell

Now, check the available commands using the following command:

PS > Get-Command -Module *Dashboard*

A dashboard is composed of one or more pages with one or more components. These components are:

  • Charts
  • Grids
  • Formatting
  • Inputs
  • Monitors
  • Pages
  • Tables
  • Customs

In order to start with PoshUD, you can use the following cmdlets:

To list your dashboard:

PS > Get-UDDashboard -Name ‘myFirstDashboard’

To stop the dashboard:

PS > Get-UDDashboard -Name ‘myFirstDashboard’ | Stop-UDDashboard

To create a dashboard

PS > Start-UDDashboard -Port 1000 -Dashboard ‘myFirstDashboard’ -Name ‘ContentDashboard’

Now you can create your first dashboard, which is very basic:

Start-UDDashboard -Content {
New-UDDashboard -Title “Hello, PoshUD” -Content {
New-UDCard -Title “Hyper-V Dashboard”
}
} -Port 1000 -Name ‘myFirstDashboard’

How to create Hyper-V Dashboard using Windows PowerShell

Let me explain the previous PowerShell code:

  • Start-UDDashboard: This cmdlet indicates to start a new or an existing dashboard
  • New-UDDashboard: this cmdlet indicates to create a new dashboard
  • New-UDCard: This cmdlet indicates to create a text card. Cards are a convenient means of displaying content composed of different types of objects
  • To finish, the Start-UDDasboard will be exposed on the port number 1000

As you could imagine, PoshUD can be used in order to create dashboards for all the products that can be accessed using PowerShell. You can query a monitoring tool, a database server, a ticketing product … and generate nice dashboards.

PoshUD in Docker

One of the great thing with PoshUD is the ability to run it in a Docker instance. You can isolate your dashboard to run in a very light instance of Docker. First, start Docker and download the latest microsoft/powershell Docker image from the Docker Hub using the Docker pull command.

Open your PowerShell Command prompt as Administrator and search for the microsoft/powershell image. Then, confirm if the image is visible with the Docker images command:

How to create Hyper-V Dashboard using Windows PowerShell

Now, copy and paste your dashboard in this folder C:\Temp\Docker, then you can run the following command to start your Docker Container. This command will mount a volume from your host to the Docker Instance:

PS > docker run -d -p 1000:1000 –rm –name poshud -i -v c:\Temp\Docker:/PoshUD microsoft/powershell

How to create Hyper-V Dashboard using Windows PowerShell

I exposed the port number 1000, because my dashboard will run on this port. Finally, run this command to start the dashboard inside the Docker container:

docker exec -i poshud powershell -file ./PoshUD/dashboard.ps1

You need to get the IP address of the Docker Instance, so you can use the Docker Inspect command:

docker inspect -f ‘{{range .NetworkSettings.Networks}}{{.IPAddress}}{{end}}’

How to create Hyper-V Dashboard using Windows PowerShell

Open your favorite web browser, and navigate to the Docker Container IP Address.

How to create Hyper-V Dashboard using Windows PowerShell

PoshUD with VMware?

PowerShell Universal Dashboard is cross-platform and simply use Windows PowerShell, so you can use it to create your VMware dashboard as we just performed for the Hyper-V environment. You just need to install PowerCLI on your machine, and then use it in your PowerShell script.

I advise you this article to understand how to use PowerCLI: https://www.bdrsuite.com/blog/managing-vsphere-using-vmware-powercli/

For those of you who work with PowerCLI and Hyper-V PowerShell module installed on the same machine, you could have an issue when running the Get-VM cmdlet as shown below:

How to create Hyper-V Dashboard using Windows PowerShell

By default, the PowerCLI module will be used instead of the Hyper-V Module. To avoid this issue, you can define your own prefix when loading a module. Here, I will load the Hyper-V module on my workstation:

PS > Import-Module -Name Hyper-V -Prefix Hyp

How to create Hyper-V Dashboard using Windows PowerShell

When I run the Get-VM cmdlet, PowerCLI will be used by default, but now if I want to list all the Virtual Machines in my Hyper-V environment, I can use the Get-HypVM cmdlet.

Resource Metering in Hyper-V

If you do not want to use Windows PowerShell to track Hyper-V resources, you can use Resource Metering. It allows Hyper-V administrators to track CPU usage, RAM and the network utilization of Virtual Machines working on a host.

How to create Hyper-V Dashboard using Windows PowerShell

You will not see any indication that Resource Metering is enabled, so please check with the following command:

PS > Get-VM -Name VMM | Format-Table Name, State, ResourceMeteringEnabled

How to create Hyper-V Dashboard using Windows PowerShell

As you can see, the “VMM” Virtual Machine is shown as one with enabled metering. Resource metering allows you to record the following information:

  • Average CPU usage
  • Average memory usage
  • Minimum memory usage
  • Maximum memory usage
  • Maximum disk allocation
  • Inbound network traffic
  • Outbound network traffic

Now, it is very simple to retrieve the measured values. Use the “Measure-VM” cmdlet and check the results:

How to create Hyper-V Dashboard using Windows PowerShell

The Virtual Machine was powered off when I first ran the command, so after starting the Virtual Machine, information are collected.

Hyper-V Reporting

If you want to just use Windows PowerShell in order to create your own Hyper-V reports without using PowerShell Universal Dashboard, then here are the most popular scripts available on the TechNet Gallery:

You can customize these scripts by adding the “Measure-VM” cmdlet in order to display the resource metering in your dashboard.

Useful Links about PoshUD

Below are some useful links that you can use to start with PowerShell Universal Dashboard:

Conclusion

With Windows PowerShell, you can easily create a dashboard but using PowerShell Universal Dashboard tool, you can create awesome dashboard. I advise you to use it to build your Hyper-V and VMware dashboards because these dashboards can be refreshed automatically. PoshUD can be a very nice tool for Virtualization Admin. You only need time to create your dashboard.

Thus, with this tool, monitoring Hyper-V will become very cool without buying an expensive third-party product.

Related Posts:

Top 7 Hyper-V Monitoring Tools for Host and Guest VMs
Beginners’ Guide for Microsoft Hyper-V: What is Azure Monitor for Hyper-V – Part 46

Follow our Twitter and Facebook feeds for new releases, updates, insightful posts and more.

Rate this post