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

0

u/[deleted] Apr 03 '19

[deleted]

3

u/MadBoyEvo Apr 03 '19

Use once (and on any subsequent updates when I release them)

Install-Module Dashimo -Force

And here's a basic example. Create file Test.ps1 anywhere and put that in:

Import-Module Dashimo

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

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

That's it. You go from there, expanding as you need it.

0

u/[deleted] Apr 03 '19

[deleted]

3

u/MadBoyEvo Apr 03 '19

Here's more complicated example:

$Process = Get-Process | Select-Object -First 30
$Process1 = Get-Process | Select-Object -First 5
$Process2 = Get-Process | Select-Object -First 10

Dashboard -Name 'Dashimo Test' -FilePath $PSScriptRoot\Dashboard1.html {
    Tab -Name 'First tab' {
        Section -Name 'Test' {
            Table -DataTable $Process
        }
        Section -Name 'Test2' {
            Panel {
                Table -DataTable $Process1
            }
            Panel {
                Table -DataTable $Process1
            }
        }
        Section -Name 'Test3' {
            Table -DataTable $Process
        }
    }
    Tab -Name 'second tab' {
        Panel {
            Table -DataTable $Process2
        }
        Panel {
            Table -DataTable $Process2
        }
        Panel {
            Table -DataTable $Process2
        }
    }
}

0

u/[deleted] Apr 03 '19

[deleted]

2

u/MadBoyEvo Apr 03 '19

I am not sure how I can help you. I use this to generate HTML that I send via email or host a simple website for data visibility.

The idea is that any Object you create that you often check like that: $Object | Format-Table -Autosize can be output to HTML.

2

u/xAretardx Apr 03 '19 edited Apr 04 '19

Here is a simple one say you are trying to get a list of all the folders that exist recursively in the users folder ie all user profiles on the machine.

$Desktop = gci "c:\Users" -Recurse | ?{ $_.PSIsContainer }| Select-Object

Dashboard -Name 'Dashimo Test' -FilePath "c:\Users\Richard\Desktop\Dashboard1.html" {
    Tab -Name 'First tab' {
        Section -Name 'Test' {
            Table -DataTable $Desktop
}}}


Normally you would maybe sort this out grab only a few items from the list and kick it out into a .csv file to sort into. Instead this dumps it out into a nice html page

Now you could go deeper and do a for each folder in the users folder make a tab for that user folder and then recursively climb through that one. Now you have a nicely sorted tab for each user folder on the machine and a searchable detailed view of the contents in each location. Each one could be looked at and exported on its own to excel or csv or pdf.

Im to lazy this early to test that out but it could work nicely.

This is very cool

0

u/[deleted] Apr 03 '19

[deleted]

3

u/MadBoyEvo Apr 03 '19

Instead of doing $YourAdUsers | Export-CSV

You can simple use Table -DataTable $YourADUsers

After that's done you can see if output works. If it does... you can attach it to email and send. All you described is possible.

0

u/[deleted] Apr 03 '19

[deleted]

2

u/xAretardx Apr 04 '19

What MadBoy said that sounds like a very doable usage of this tool.

1

u/Lee_Dailey [grin] Apr 03 '19

howdy xAretardx,

reddit likes to mangle code formatting, so here's some help on how to post code on reddit ...

[0] single line or in-line code
enclose it in backticks. that's the upper left key on an EN-US keyboard layout. the result looks like this. kinda handy, that. [grin]
[on New.Reddit.com, use the Inline Code button. it's 4th 5th from the left hidden in the ... ""more" menu & looks like </>.
this does NOT line wrap & does NOT side-scroll on Old.Reddit.com!]

[1] simplest = post it to a text site like Pastebin.com or Gist.GitHub.com and then post the link here.
please remember to set the file/code type on Pastebin! [grin] otherwise you don't get the nice code colorization.

[2] less simple = use reddit code formatting ...
[on New.Reddit.com, use the Code Block button. it's 11th 12th one & is just to the left of hidden in the ... "more" menu.]

  • one leading line with ONLY 4 spaces

  • prefix each code line with 4 spaces

  • one trailing line with ONLY 4 spaces

that will give you something like this ...

- one leading line with ONLY 4 spaces    
  • prefix each code line with 4 spaces
  • one trailing line with ONLY 4 spaces

the easiest way to get that is ...

  • add the leading line with only 4 spaces

  • copy the code to the ISE [or your fave editor]

  • select the code

  • tap TAB to indent four spaces

  • re-select the code [not really needed, but it's my habit]

  • paste the code into the reddit text box

  • add the trailing line with only 4 spaces

not complicated, but it is finicky. [grin]

take care,
lee