Invoke-PSUScript Object error

image


image

Having problems with the cmdlet “Invoke-PSUScript”. I can get it to work if I use the long hand method.
“Invoke-PSUScript @ScriptParams | Tee-Object -Variable CurrentJob | Wait-PSUJob”

not sure if I am using the cmdlet incorrectly but the line that is causing an error is
“$CurrentJob = Invoke-PSUScript -Script ‘return.ps1’ -Wait”

I also tried “Return.ps1” to see if caps mattered and still got the error.

Product: PowerShell Universal
Version: 3.0.0

Had similar issue in my dashboard, so maybe try this tip from Adam:
Invoke-PSUScript -id $EventData.Id -AppToken $PSUAppToken -ComputerName http://localhost:5000

Adding the -ComputerName was the missing part for my task.

Figured out if I remove “-Wait” it processes correctly and I did test it with passing params

Is there a way to run a different “-wait” process because I need that to work for my scripts

If there is no native -Wait, you could maybe do a Do/Until or Do/While and check the status of the script job?