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 .
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.