Introducing PowerShell Universal Dashboard

Universal Dashboard (PoshUD or UD) is a great PowerShell module created by MVP Adam Driscoll.

What is it?

Universal Dashboard is a cross-platform PowerShell module for developing and hosting web-based, interactive dashboards. It means that you can use your PowerShell skills to develop awesome dashboards! The Web-Based Dashboards are built entirely in PowerShell.

One of the cool things is that you can run Universal Dashboard anywhere PowerShell is installed! So yes, you can run UD on Windows, Linux, … You just need to have Windows PowerShell v5 or PowerShell Core v6 installed on your machine in order to run PoshUD.

Getting Started

Let’s start by installing the PoshUD module. PowerShell Universal Dashboard is available on the PowerShell Gallery but it is not free. You must have at least a trial license. Run the following command in order to install PoshUD from the Powershell Gallery:

PS > Install-Module UniversalDashboard

Untrusted repository
You are installing the modules from an untrusted repository. If you trust this repository, change its InstallationPolicy value by running the
Set-PSRepository cmdlet. Are you sure you want to install the modules from 'PSGallery'?
[Y] Yes  [A] Yes to All  [N] No  [L] No to All  [S] Suspend  [?] Help (default is "N"): Y

Let’s confirm that UniversalDashboard has been installed:

PS > Get-Module -ListAvailable Universal*


    Directory: C:\Program Files\WindowsPowerShell\Modules


ModuleType Version    Name                                ExportedCommands
---------- -------    ----                                ----------------
Script     1.0.281    UniversalDashboard                  {New-UDChart, New-UDColumn, New-UDDashboard, Get-UDDashboard...}

Now, we need to generate a trial license. Copy and paste the following script or get it from here:

Start-UDDashboard -Content { 
    New-UDDashboard -Title "Charts" -Content { 
        New-UDInput -Title "Send an email" -Endpoint {
            param($EmailAddress)
                Send-MailMessage -To $EmailAddress -From adam@poshtools.com -Subject "Hello, Universal Dashboard!"
 
                New-UDInputAction -Toast "An email was sent to $EmailAddress"
            } 
    }
} -Port 8080

 

And open your favorite web browser and type the following URL: http://localhost:8080/

Enter your email address in order to receive a trial license. Copy and paste the license:

and refresh the page in order to display your first dashboard!

Done! You have successfully installed your first web dashboard!

Customizations

You can easily customize your dashboard. Let’s imagine you want to list the 10 largest files in a folder. Copy and past the following code:

Start-UDDashboard -Content { 
    New-UDDashboard -Title "Top 10 Largest Files" -Color '#34495E' -Content { 
        New-UDTable -Title "[www.get-cmd.com]" -Headers @("Name", "Last WriteTime ", "Length") -Endpoint {
              gci | sort Length -Descending | select Name, LastWriteTime, Length -First 10 | Out-UDTableData -Property @("Name", "LastWriteTime", "Length")
          }
      }
 } -Port 1006

This code will create a new dashboard listening on: http://localhost:1006. This dashboard will display the top 10 largest files in your current folder.

That’s all. Thanks to Powershell Universal Dashboard, you can now easily create your own dashboards.

If you need more examples, you can go on this page: https://github.com/adamdriscoll/poshprotools/tree/master/examples

 

Thanks for reading! You can follow me on Twitter @PrigentNico

About Nicolas 279 Articles
I work as an IT Production Manager, based in Paris (France) with a primary focus on Microsoft technologies. I have 10 years experience in administering Windows Servers. . I am a Microsoft MVP for Cloud & Datacenter Management. I also received the PowerShell Hero 2016 award by PowerShell.0rg. And finally, I am "MCSE: Cloud Platform and Infrastructure", "MCSA: Windows Servers", "Administering & Deploying SCCM", and CheckPoint CCSA certified.