Request - 3 more pre-defined variables in Dashboards

Request - 3 more pre-defined variables in Dashboards

avatar
(anonymous user)

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:

  1. $DashboardName - ex ‘MyTestDashboard’
  2. $DashboardFilePath - ex ‘MyTestDashboard.ps1’
  3. $DashboardBaseUrl - ex ‘/myTestDashboard’

If this could be added that would be very helpful!

Thanks

Product: PowerShell Universal
Version: 2.0.3


All Comments (9)

avatar

Sure thing! I can get those added

Adam Driscoll
PowerShell Expert and Developer at Devolutions

avatar

Do you have a timeline / version number these variables will be added?

Also, $Identity would be nice to have available in Dashboards too. Currently it only exists in the API scope.

Thanks!

avatar

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.

Adam Driscoll
PowerShell Expert and Developer at Devolutions

avatar

I can’t seem to get the variables $Identity or $UserName working with my PSU Dashboard instance. Currently running a nightly build from 10/12 (2.5.0).

What variables do I have access to in Dashboards? Is it different than the list on Docs?

Also, I’m running my Authorization through OIDC with an Azure App.

avatar

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.

Adam Driscoll
PowerShell Expert and Developer at Devolutions

avatar

I got $user to work - thanks for the sample code to get variables in a dashboard session. I’m definitely going to save that for later

avatar

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?

avatar

Dashboards was renamed Apps in 4.0

Did you try to check if there was another variable with the data you need?

$Data = Get-Variable | Select Name, Value
New-UDTable -Data $Data

avatar

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.