Using a variable from a UAScript

Invoke-UAScript -Script C:\Temp\Script1.ps1 | Tee-Object -Variable job

I have a dashboard that uses line above to execute a ps1 script as a PowershellUniversal job. How can I take a variable that is created within the ps1 file and use it in my dashboard? For example, If Script1.ps1 stores active directory user properties in $User, how can I use the $User in my dashboard file to display /manipulate that variable as needed?


Product: PowerShell Universal
Version: 2.1.2

You will need to use the server level cache to store data from jobs to dashboards. Jobs and dashboards run in different processes so this will allow you to set data for use across all features of PSU.

If you are using the integrated for everything, you can also use the $Cache scope since they all run within the same process.