Invoke-UAScript issue?

I’ve got a couple of scripts in UA and need one to pass a parameter to the next. Seems from the documentation like it should be possible like this?


I’ve tried with a few different parameter names, but Invoke-UAScript line always returns:

[ERR] A parameter cannot be found that matches parameter name ‘testvalue’.

Updated to 1.3.1 this morning to see if that helped, but seems the same.

It’s before the parameter that it hits the issue I think - just tried without any (have tried this using -name test.ps1 and also -id 3) and receive:

[10:55:46] [ERR] Call failed with status code 403 (Forbidden): POST http://localhost:5000/api/v1/script/3

This is being kicked off from within UA, so it shouldn’t need an app token, right?

Get-USAcript works fine:

$script = Get-UAScript -name ‘test.ps1’

Outputs the contents of the script.

So seems to be I’m missing execute permissions?

you need to use the apptoken that has enough permissions to do this.
Example: Invoke-UAScript -Id 18 -TamCustomer $_.CustomerId -AppToken $fullAppToken

Ah, even from another script within UA? I’ll give it a shot.

Doc seemed to suggest it wasn’t required, or is that just for Invoke-UAJob?

Call Scripts from Scripts

You can also call UA scripts from UA scripts. When running a job in UA, you don’t need to define an app token or the computer name manually. These will be defined for you. You can just call Invoke-UAScript within your script to start another script. Both jobs will be shown in the UI. If you want to wait for the script to finish, use Wait-UAJob .

Oh, my bad, didn’t see that it was from within a script, have not tried that…

Were you able to solve this? I am scratching my head running into the same thing. It seems that an app token is indeed required despite the documentation specifically stating it is not. Even with an app token, I get a A parameter cannot be found that matches parameter name ‘ServerName’. error.