r/PowerShell • u/PorreKaj • Jan 19 '19
Universal Dashboard Sample
I posted yesterday about a Dashboard displaying information on our company's consultants. and a few guys/guyettes asked if I could share the code.Well, not exactly, but i managed to built something similar, without the company specifics.
https://github.com/PorreKaj/UD-Sample/
Simply install UniversalDashboard.Community 2.2.1 (requires .net 4.7.2), download the script and run it (well, don't just run stuff from the internet tho).It pulls data from AD so the ActiveDirectory module needs to be installed too.
note: To stop the dashboard, use Get-UDDashboard | Stop-UDDashboard
Once running, you can visit http://localhost:10001/ and see a dashboard with 3 pages.
(If that port is used, you can change the port number on the last line of the script.)
# Page 1 AD Dashboard, simple counters, donut chart, and a search box that's a bit more on the advanced side, search result will have a button that open a popup (modal) and show a bit more information on the account.(The search box is almost a direct copy of the one available on Ud marketplace - https://marketplace.universaldashboard.io/Dashboard/ud-activedirectory)

# Consultant dashboard.So this view is a bit more fun, but it relies on consultants being members of a group (in our case named "Consultants"), the name of the group can be changed on line 21 in the script.

# ServersSomeone out there asked if this could be used to monitor server metrics.Of course!, if you can get to the data with powershell, you can display it.
in this case, the docs specifically show how to do this - https://docs.universaldashboard.io/components/monitors
CPU and Memory monitors will be displayed for localhost, and for 2 servers you'll have to define in line 6 and 7.I didn't have time to do anything fancy, so these monitors only show data while the page is running, refresh and they'll start all over.

I tried to keep the code behind "segmented and neat" but it gets messy fast, and I ran out of time for today.
let me know how it goes.
Edit: forgot a block of code for the 'Employees by department' chart - ISE remembered the data for the chart so it never showed.
3
u/Zeniaz Jan 19 '19
So I'm trying to change Distribution of Employees by Department to By Office field instead. How would I go about doing that? I tried changing the "Department" fields to "Office" it doesn't seem to work.