Product: PowerShell Universal
Version: 5.6.0
Hi.
We are currently migrating our entire PSU environment from version 4.2 to 5.6 which is quite a big leap. The biggest problem seems to be the old “Pages” (the XML based ones), we have a bunch of those. What is the easiest way to convert those to PSU 5? Most of them are very simple ones, just some input fields that are then sent to a script. From what I understand this is a manual job that needs to be done, there are not conversion tools? Question is what to use for them… I’ve looked at the new portal pages and widgets, they seem overly complicated for this. Would it be easiest just making apps out of them?
Personally I’d just use the form components on a regular page/app/dashboard, and then when submit is pressed send all your variables into Invoke-PSUScript with the relevant parameters. Shoudnt be too much to throw together some code, but then once you have a working example you can pretty much just copy and paste and change the form components and the script thats being called.
Yep, that’s exactly what I’ve started doing. First one took me half an hour, but as you say, most of it can just be copied. I just thought that maybe there was some shortcut I’d missed 
Follow up question! The scripts used in v4 does a whole lot of Write-Output, which magically ends up in the browser window, with the help of the “Show Output” setting. If I want to call the same script in an app in v5, what is the best way to get the script output to the user without changing in the script? I could just pipe the output into a variable and show it in a div with Set-UDElement, but that will be an one-shot, some scripts continue feeding out information which the user wants to see in real time…
I personally have had to use New-UDDynamic and Autorefresh on the item to get a continued update. Just a note to use a different ID so different regions do not update with the same data.
Not sure if there’s an equivalent feature in v5, hopefully there is for convenience but you could use Show-UDToast too, depends on how you want it to display I suppose.
I ended up with a dynamic region and then I replaced all my Write-Outputs with calls to this instead:
function Write-Live($msg) {
$Session:LiveLog += “$(Get-Date -Format HH:mm:ss) $msg`n”
Sync-UDElement -Id ‘livelog’
}
I would have preferred not to need to tamper in the script, but this will do!