Executing Jobs via Orchestator VS UiRobot.exe

Hey Community,

I am executing a job via UiRobot.exe command line and when I look into the Jobs table on Orchestrator the unattended bot picks it up with the source of “Agent” but then fails with the following error : " System.IO.DirectoryNotFoundException: Could not find a part of the path". But when I execute the same job on the same unattended robot through Orchestrator, it runs without a problem.

I have checked if the VM can reach that path destination and it can. Any recommendations will help.

Thank you.

Check this post maybe it helps you:

Also, try to provide the full path of the UiPath.exe file location.

1 Like

Hey Marian,

Thank you for the recommendation but it looks like the command is going through with UiRobot.exe to Orchestator though so I am not too sure if that would be the issue. I have also looked at the activity of where it is crashing at, and it also has the full file location. For this location, it is located on a remote drive.

Show the screenshot in order to see how you configured command.

Invoke-Command -ComputerName $RobotServer -ScriptBlock{
param (
$ProcessinRemote)
& "C:\Program Files (x86)\UiPath\Studio\UiRobot.exe" execute --process $ProcessinRemote --folder 'Default'} -ArgumentList $Process -ErrorVariable $sLogFile
Write-LogInfo -LogPath $sLogFile -Message "$RobotServer is now running $Process."
Write-LogInfo -LogPath $sLogFile -Message ' '

This is in powershell that will execute a process that is located in the Default folder. But I believe there might be something that is being cached when executing jobs via UiRobot.

Can you check if for $ProcessinRemote you are providing the value for ProcessKey?

After, check to run manually this command in the robot machine:

$ProcessinRemote = "REPLACE_WITH_YOUR_ProcessKey"
& "C:\Program Files (x86)\UiPath\Studio\UiRobot.exe" execute --process $ProcessinRemote --folder "Default"

Note: Make sure that the robot is connected to Orchestrator in order to see and execute the processes.

Which are the results?

It looks like that command was able to execute and saw the job begin to run in Orchestrator but in the Orchestrator logs it still says: System.IO.DirectoryNotFoundException: Could not find a part of the path" and fails the job.

Ok, then check what is doing that workflow as it is not clear from where exactly you receive “System.IO.DirectoryNotFoundException: Could not find a part of the path”. Maybe you have some input arguments to that job and you are not providing them. There can be various reasons.

I looked at the workflow to see exactly where that error is at, and it looks like the error is coming from an append line activity not being able to find that file path. Before, the file path had a variable in it (ex: var + “filename.txt”), so I went ahead and put the full file path without the variable (ex: “R:\Programs\filename.txt”) and still getting that error. The file path is located on a mapped drive and the bot has access to it. But is there another protocol that UiPath uses when a job is executed via agent vs manually to locate a file on a mapped drive? Because executing the job on Orchestator(Manually), I don’t get an error but with executing it through the agent, I do.

In powershell scripts the relative paths are not working. You need to provide full paths. Double check all the paths which you are using in your scripts.

Maybe some of them are not correctly formatted.


For example / can be \\ or //

My apologies, the file path is not being called in the powershell script but rather in the UiPath Studio work flow in the append line activity of where to write the line at.

Are you an Enterprise customer?

I am.

I was looking more into the issue and was thinking, is there a way to look at the credentials and security set up for the unattended robots because the robot may not have access to the path location, which would throw this error.

You can raise a ticket with support.

For the credentials set in Orchestrator, check this approach:

Open a powershell.exe console as Administrator and run this command:

[Environment]::SetEnvironmentVariable("UIPATH_HEADLESS_WITH_USER", "True", "Machine")

After sign out and check again the behavior.

https://docs.uipath.com/robot/standalone/2023.4/user-guide/background-process-automation#running-background-processes

It looks like that didn’t work either. It is weird because when I do the PowerShell script, it hits the Robot Agent on the VM and fails but when I click retry on the VM, it is successful. It may be a bug with this version but most likely will open a ticket.