My apologies for the newbie-ish question; I just stumbled on to Powershell Universal Dashboard yesterday and first blush seems pretty cool!
I am trying to use this as a lightweight status display for a series of licensing servers that we have. As such, I need to call out to a program outside of Powershell, chop up the output, and drop it into the dashboard.
My problems are basically these:
I have a custom function that returns the data I want but I cannot seem to use it inside of the dashboard. I have gotten external variables to work with New-UDDEndpointIntialization -Variable but using this for a function doesnāt seem to work. Hereās a little sample I whipped up that fails miserably:
function Test-Function {
Return 1
}
$Dashboard = New-UDDashboard -Title āThis is a little testā -Content {
New-UDEndpointInitialization -Function āTest-Functionā
New-UDCard -Title āThe Titleā -Endpoint {Test-Function}
}
Start-UDDashboard -Port 80 -Dashboard $Dashboard -AutoReload
What am I doing wrong?
I am getting something like this inside the card:
The term āTest-Functionā is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name, or if a path was included, verify that the path is correct and try again.
From a higher level, I am looking for advice on approaches to bringing this information to life in PUD. I started out setting up an array of all of my variables for each license service in an array and then building out the dashboard. I ran into problems getting data into the dashboard from that powershell so re-doubled effort on reading the documentation and decided to make a usable function that I could call from within the dashboard elements and spit out some text. If you had to call out to a program, parse and slice the returned data, to display within UD (and repeat that same process multiple times), how would you approach it?
Thanks for listening to the newb questions!
āmjn
P.S. The documentation is great and looks polished but I think it fails because it does not address most functionality in context. For example, I found the New-UDEndpointInitialization documentation and have tried calling that inside and outside of the dashboard Iām creating, and I have tried calling the initialized function I am using multiple ways; I still donāt truly know what the correct way might be in either case.
I had this issue the other day when trying to wrap my head around it. I was able to dig through some of your codebase and found some examples that showed it being used like this.
Documentation is a hard thing to keep accurate and up-to-date, especially on such a large module.
Hi,
Is the syntax the same if the function would return a string-value?
as when i change the returnvalue to āTest 1ā, nothing is returned in the GUI
@adam - I do not have any issue declaring the variable independently to EndpointInitialization, but not through a foreach object. How do you pass variable from a foreach object? Something like below.
I checked all var in the foreach to a UDcard, output are correct. I hope you can enlighten me on how to correctly do this. Thanks!
UPDATE:
Let me be a little clear, with a simple string it worked. What I am trying to achieve is to ensure condition of ā$userā or ā$ClaimsPrincipal.Identity.Nameā is matching with $a. I was able to run and display all these var in a UDcard. But EndpointInit did not capture the var.
We do not have the a dedicated ADgroup for users, so I need to load these users manually with their primarySID or Name and cross-check with their authentication sessions. Any advise?