I have scheduled a script with UA, how could I verify that the script is not already running before to launch it ?
From another script I tried this :
Get-PSUScript -Name 'test.ps1' -ComputerName '127.0.0.1'
But I got a 403 Forbidden error.
Any help would be welcome
When you want to get information on a script, you should refer to the job that actually does the ‘running’ of said script.
There’s solid documentation available on this subject right here.
The 403 forbidden you’re getting most likely is due to not including any method to authenticate your request to the server.
Have a look at Tokens and how to use them over here.
I took my informations from this documentation exactly.
It is said :
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-PSUScript 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
I thought it was the same with Get-PSUScript …
I tried to specify a valid token, but same result.
You should be able to use the integrated mode to avoid app token issues.
Get-PSUScript -Name 'test.ps1' -Integrated