We are working on adding logging to our PowerShell Universal instance and believe that it would be quite helpful to have three additional pre-defined variables available in dashboards:
$DashboardName - ex ‘MyTestDashboard’
$DashboardFilePath - ex ‘MyTestDashboard.ps1’
$DashboardBaseUrl - ex ‘/myTestDashboard’
If this could be added that would be very helpful!
These will be available in 2.3.0 which will be released September 14th. We’ve moved to a monthly release for all products on the second Tuesday of the month.
I’ll check on the $Identity variable. I thought that had been added to dashboards but maybe we have a bug there.
You can use this to look up all variables in your dashboard:
$Data = Get-Variable | Select Name, Value
New-UDTable -Data $Data
Also, the docs had the wrong variable (fixed). It should be $User not $UserName. I don’t see $Identity referenced but I’m assuming you’re looking for $ClaimsPrincipal.
Hi.
I’m trying to use $DashboardName in an app in psu 4.0 but no matter what I do it is empty. Any idea what could cause that? It should contain the value of the name setting of the app, right?
Thanks. Found the fault. I did my test in the code of the app but not inside the code of a page, seems that variable isn’t set then. Doing the same thing inside the contents of a page works fine.