I have an computer running the Devolutions agent registered with PSU. I can target that agent when submitting a job via the GUI, how can I do so when I run Invoke-PSUScript from PowerShell? I have tried using the -ComputerName parameter, however that doesn't work.
Hello Shannon,
Thank you for your question. You can target the agent from PowerShell too.
Use the -Queue parameter with the agent's name instead of -ComputerName. On Invoke-PSUScript, -ComputerName is the address of the PowerShell Universal server that the cmdlet connects to, not the computer that runs the job.
Here is the example from our documentation, with your script name and your agent's name in place of the two quoted values.
Invoke-PSUScript -Name '.\Inventory.ps1' -Queue 'devolutions-agent-01'
Use the name the agent shows under Manage > Computers & Groups > Computers in the admin console. That name is the AgentId from the agent's configuration, or its display name when no AgentId was set. PowerShell Universal matches the -Queue value against that name, so it has to be the same text. If you run the command from outside PowerShell Universal, keep -ComputerName as well and give it your server's URL, and the job still goes to the agent named in -Queue.
The section "Run jobs on an agent" of this page describes it.
https://docs.devolutions.net/powershell-universal/config/agent/#run-jobs-on-an-agent
If the job fails or does not run on the agent, please reply with your PowerShell Universal version and the exact command you ran, and I will look into it.
Best regards,
Michel
Michel Audi