Using powershell script as trigger

Hello everyone,

I wanted to try to trigger a Unattended Robot with a powershell script. Here’s how I want it works :

  1. A powershell script monitor one (or multiples) folder
  2. This script add a item to a orchestrator’s queue if any file is put into this folder
  3. This queue trigger the unattended robot
  4. The robot do the process

Why don’t you call the robot periodically?

In order to use as little as possible in anticipation of having other robots and other treatments to do later.

Why not use the activiter trigger?

Because it is not worth leaving a robot permanently activated for only one type of treatment.

I made some search on powershell interactions with orchestrator API and I found this :

I managed to install the powershell module but I can’t connect with Get-UiPathAuthToken even though my orchestrator url is good ( and my credentials are good too. Is someone already tried to call orchestrator API with powershell could help me to connect and add a queue item ?


I have not used these PS modules. I could start the jobs via the startJob API using below code. Hope this helps.

$json = “{”“tenancyName”" : ““Default””, ““usernameOrEmailAddress””:"“admin user”", ““password”” : ““admin password””}"

$out = Invoke-WebRequest “https://yourorchestrator/api/account/authenticate” -Method Post -Body $json -ContentType “application/json”
$token = $out | ConvertFrom-Json
$bearerToken = $token.result

$headers = New-Object “System.Collections.Generic.Dictionary[[String],[String]]”
$headers.Add(“Authorization”, “Bearer $bearerToken”)

$json_body = “{”“startInfo”": {"“ReleaseKey”": ““xyz-xyz-xyz-xyz””,"“RobotIds”": [xx],"“NoOfRobots”": 0,"“Strategy”": ““Specific””}}"
Invoke-WebRequest “https://yourorchestrator/odata/Jobs/UiPath.Server.Configuration.OData.StartJobs” -Method Post -Body $json_body -ContentType “application/json” -Headers $headers

Shiju Mathew