r/PowerShell • • Apr 02 '19

Dashimo - PowerShell Generated HTML Dashboard in a single file

Something that may come useful to you guys. Recently I've written Dashimo which allows creating HTML dashboards in a very easy, intuitive way. With it, you no longer have to build an object and then play with HTML to get it to display correctly in HTML.

The whole idea with screenshots is described in my blog.

https://evotec.xyz/meet-dashimo-powershell-generated-dashboard/

Dashimo generates a single HTML file that you can attach to email or host on a website. There is no DB or anything else. Keep in mind this can't be used as Email Content because it holds JS and heavy CSS. But you can attach it to email and the features it holds within that HTML are well worth it.

On my blog, I'm explicitly showing it using my Active Directory module but you can pass anything to Table. Even $Object = Get-Process if you really want to.

Dashboard -Name 'Dashimo Test' -FilePath $PSScriptRoot\Dashboard.html {
    Tab -Name 'Forest' {
        Section -Name 'Forest Information' -Invisible {
            Section -Name 'Forest Information' {
                Table -HideFooter -DataTable $DataSetForest.ForestInformation
            }
            Section -Name 'FSMO Roles' {
                Table -HideFooter -DataTable $DataSetForest.ForestFSMO
            }
        }
   }
} 

The easiest sample looks like this.

$Process = Get-Process | Select-Object -First 30

Dashboard -Name 'Dashimo Test' -FilePath $PSScriptRoot\Dashboard1.html {
    Section -Name 'Test' {
        Table -DataTable $Process
    }
}

You can have as many sections/panels as you need. Tabs also work just fine. Charts are coming sometime soon.

130 Upvotes

90 comments sorted by

View all comments

6

u/Tonedefff Apr 02 '19

This looks great! I had just started on a very simple HTML dashboard project from scratch (using ConvertTo-HTML), but I might have to try out Dashimo instead, as it does a lot of the things I was planning and many I didn't think of (like exporting and search).

Some ideas/thoughts:

It would be nice to have the page automatically refresh, so you can run the .PS1 that generates the page on one computer every 5 minutes or however often, then other computers can load the HTML file via a network share and it would automatically refresh every 60-180 seconds, or whatever you want. It would also be handy to have a "Last Updated" timestamp, so you can see exactly how old the data is.

<meta http-equiv="refresh" content="180" >

Is there a way to specify what properties of an object you want included in the table? Or would you just use Select-Object?

This is probably advanced functionality and not sure how simple it would be to implement with PSWriteHtml, but it would be great to apply conditional formatting to rows based on certain column values. For example if you had a table showing recent failed login attempts, any user with more than 3 failed logins could have its row's background color changed to red.

6

u/MadBoyEvo Apr 02 '19
  • Autorefresh parameter is there already. It's called AutoRefresh and it's in seconds. If it's 0 it doesn't autorefresh (default).

  • You need to do | Select-Object. I probably could add that, but it would be doing this for you. Doable but not sure required?

  • Tables are based on https://datatables.net/examples/index I do see it having different options, actually a lot, that I didn't touch. Adding a color should be simple add using CSS in for TR/TD but the conditional part and delivering part.... how would you tell Table about it?

@{ ColumnName = 'Days', Name = '3' ; Color = 'Red' } ? 
  • Give me some ideas for it, how would you define this to not be complicated and wouldn't cause false positives? I added some coloring in PSWinReporting but it was coloring everything it would find that matched.

2

u/MadBoyEvo Apr 03 '19

Actually I have an idea for this. Will implement CondittionalFOrmatting.