Is it possible to show results from multiple computers in one table on a dashboard? for example I would like to get disk space usage from multiple servers / computers across my AD environment and then show that information in a single table, with server name in one column, drive letters across the top, and free space in cells for each drive.
Furthermore is it then possible to highlight in some way certain cells if value is below a specified amount? to make it stand out, and perhaps also show an alert as well?
I would also like to do similar to show state of specific windows services on serval servers which are prone to stopping without warning so we can have a single place to easily view the current state of these services, again potentially with clear highlighting / alerting if stopped and perhaps a button to start the service from the dashboard.
As I say I am new to Powershell Universal so still learning so would appreciate to know if this is possible and perhaps some pointers from more experienced users on how to at least start implementing some of this, I learn best from seeing examples of how stuff works so I can then build on it from there.
Sure is. It’s all just Powershell. You’ll have to query that information within your dashboard though.
Absolutely. You’ll want to use the -render parameter on New-UDTableColumn. -Render accepts a script block, so from there you can do an if statement or switch.
Same as the first point.
I recommend using New-UDEndpoint to query for that information.
The reason to use the New-UDEndpoint is that you can automatically refresh the data on a schedule and it means you aren’t running it in a page, meaning it won’t cause the page to load slowly as it reaches out and gets the data in real time.
Thank you very much indeed for your response, if not being too cheeky could someone show me a simple code example of perhaps pulling results from one computer, nothing too detailed just to give me some guidance, as I said I learn best from seeing examples, and this is all very new to me, then I can get my head around how it works and expand it further. Thanks again
Just sending this output to New-UDTable doesn’t work, so obviously not as simple as that.
How would I get the information from $DiskReport into a table in PowerShell Universal with three columns - computer name, drive letter / volume name, free space
How could I improve the way I store / retrieve the information so that instead of multiple rows per server I could have just one row per server with multiple columns e.g. server name in column1, then first drive letter / volume name goes in to column 2, free space for that drive in column 3, second drive letter / volume name goes in to column 3, free space for that drive in column 4, etc - as think that might look cleaner when showing lots of servers which all have multiple drive letters?
SERVER 1 C: 56Gb D: 32Gb E: 26Gb
Thoughts / comments / input greatly appreciated from those more experienced in using this who have got existing layouts perhaps which work for showing multiple server / drive space information perhaps?
How could I improve the way I store / retrieve the information so that instead of multiple rows per server I could have just one row per server with multiple columns e.g. server name in column1, then first drive letter / volume name goes in to column 2, free space for that drive in column 3, second drive letter / volume name goes in to column 3, free space for that drive in column 4, etc - as think that might look cleaner when showing lots of servers which all have multiple drive letters?
How can I highlight a value (or row) if value below a certain figure e.g. to signify a warning if space is low for example
I can then look into the great advice in first post about using New-UDEndpoint to do the checks on a schedule etc
Okay, more progress made, have now worked out how to colour cell value depending on result, and also how to use New-UDEndpoint to check results every x minutes and refresh the content using New-UDDynamic
The one part I can’t work out and how I would prefer my table to look, especially as I start adding more servers is Q1 above, if anyone can give me some suggestions please, quick mockup of table layout to visualize what I mean below.
Updated code for what I have working so far below:-
@wingers another thing you can do to improve this is Get-CimInstance supports multiple computers, so you don’t actually need the Foreach loop.
Additionally, Get-CimInstance supports -Property. This makes sure the computer only returns data you want. You still need to do Select-Object, as it will return a bunch of blank properties on you. But this just optimizes the process in consideration to network and memory resources.
In my test case, with 3 computers it saved around 1 second. It doesn’t include a throttle command, so your mileage may vary. But it should be possible to do these things “in blocks” to prevent querying too many systems at once.
@Jori - thank you very much, I have made the changes you suggested, and when running against a long list of servers it does indeed make quite a bit of difference - so thanks
@adam - Thank you, I really like the layout you suggest it looks so much cleaner to show multiple drives, but I am having issues converting the logic in your example to work with my code. I can get it to show the values but it is still showing one drive per line rather than grouping them per computer, I think it is because my source data is formatted differently than what your example is and I can’t work out how to rework the table structure to compensate for this - below is what I have done so far. Any help would be appreciated. I also need to reimplement the conversion of the displayed value back to GB/TB etc using so it reads more easily, currently just shows as bytes which is messy.
N.B. You can run command on a single computer with multiple drives if no access to network with multiple computers to get output for testing - just using SystemName property instead of PSComputerName property e.g.
Thank you so much, that was the solution I needed and it is now working fine. Can now play about with layout and tweak it to my requirements.
Can’t believe how much fun I am having playing about with this!
A related question please - a couple of servers have a lot of drives is there anyway to have them wrap to next line rather than showing a scroll bar? - see image below, last server has two more drives appearing off screen, would be nice if they appear below instead?
-OnRowExpand I am attempting to also show an additional column which shows percentage used which is calculated based on two values I already have e.g. $EventData.Size and $EventData.FreeSpace
For some reason though the calculation keeps giving me “Attempted to divide by zero” errors.
This doesn’t make sense as values definitely are NOT zero as confirmed by value already shown on screen and when using wait-debugger to check values before the error occurs.
Also how do I get a value which is not part of my “$EventData” to appear in a column as even using -Render and trying to show something from a variable which isn’t part of $EventData the column just appears empty.
@adam - thank you, perfect solution, works perfectly - I should have thought of that, think I was overthinking it. Wish I was as good at PowerShell as you! Thanks again