In the github, there is an option for Sync-udelement called -Broadcast that sounds like it does exactly what I need in my dashboard, but it is not quite clear how it is suppose to be called. In order to make my dashboard run scripts in parallel, I simply setup multiple scripts that log to a SQL Server table. However, I still need the dashboard to query those destination tables, but I don’t want N number of users all querying it obviously so I’d prefer to have a single refresh that then pushes the update to all users who have the dashboard open.
On the old version of UD you used to be able to use sync-udelement from an API endpoint for example.
Now there’s a bit of isolation between the dashboards, API’s and scripts, I think what is needed is Sync-PSUComponent which can be used in API’s and scripts.
There’s also Invoke-UDEndpoint which I beleive can be used in a similar way if you have nested code in an endpoint that you want to trigger.
At least for Sync-PSUComponent it should have -integrated so you don’t need to auth with tokens.
As for documentation I don’t think there’s anything on these yet in the official docs, but you should be able to use get-help “Sync-PSUComponent” -full to see further properties and what params may be available, although I cant really help beyond that for lack of using these myself
Sync-PSUComponent is not recognized. I am looking in version 2.2.1.
According to the change log it was introduced in 2.3.0. Current production version is 2.5.5 so may be worth upgrading anyway!
Yea I upgraded on my test environment, but now I keep seeing:
sync-psucomponent: The ‘sync-psucomponent’ command was found in the module ‘Universal’, but the module could not be loaded. For more information, run ‘Import-Module Universal’.
And this is in an PSU Script?
I actually just ran the get-help command inside of a PSUScript and was able to return results. Before I was running in Azure Data Studio.
Not sure then I’m afraid, haven’t really played around much with it. Maybe someone else will see this thread and chime in to offer a solution. In the meantime if I do get around to testing this I’ll let you know as I’ll probably need to do something similar.
Sorry I think you misunderstood. I am good to go… just had to run get-help sync-psucomponent within the powershell universal scripts page versus running that command inside of my Azure Data Studio powershell session. Also, I tested the syncing and it seems to work fine. I guess when you pass in -id to sync-psucomponent it will loop through ALL dashboards that have an element with that ID. Basically, there is no way to specify which dashboard you actually want to update, which is odd, but not a big deal.
This is a bug and fixed in PSU 2.6. You can export the Sync-UDComponent cmdlet from the module by editing C:\Program Files (x86)\Universal\UniversalDashboard\Frameworks\v3\UniversalDashboard.psd1 and adding Sync-UDComponent to FunctionsToExport.
It will require an appToken and Computer Name in PSU 2.5.x but in 2.6 you will be able to use the integrated mode.
Thanks Adam. Is their an ETA on 2.6 release?
Next Tuesday the 14th