Running background process

I’m trying to let a Robot running a background process that I start from the Orchestrator. I used the ‘Background Process’-template to make my process, but it failed when I start it from the orchestrator. I get the error ‘message: Invoke Proces workflow: The user name or password is incorrect.’ in the log and in the Job details do I get ‘RemoteException wrapping System.IO.IOException: The user name or password is incorrect.’. When I change the project settings to background process to no, the proces is working fine. That mean that something must be going wrong in the background process.

After trying different things, I found out that one of the problems is that I check if a file exist. If I use ‘Directory.GetFiles(Location, File)’ it will give this problem. If I comment that out and only let it write a log, invoke a proces en send a mail, it will work fine.

How do I get ‘Directory.Getfiles’ working? Can I add somewhere the user name of password? Or can I somehow use the credentials from the user that is running the proces? Or can someone give me a list of activities that I can’t use in a background process?

I build the proces in studio 2019.10.4 and let it run on a unattended and a development robot (with the same results).

2 Likes

@Remco

background processes must not contain activities that require user interaction.

But checking if a file exist isn’t an activitie that require user interaction or is it?

@Remco

File Exists activity should work in Background process as it doesn’t require any user interaction.

But that is the problem, it isn’t working.

When I run my background process without searching for files, everything is working fine. When I add the following assign to the process, I get the errors in the Orchestrator
'Files = Directory.GetFiles(Location, FilesIamLookingFor)

When I change the settings for the background process to no it is working fine

@Remco

May I know what error are you getting here ?

Hi @Remco

Does the bot have access to read those files or to access that directory? Mag be that us causing the error… I do have a background process with the same command and it works fine for me…

Can you check whether the current windows login has access to that folder?

Hi,

I made 2 new process, one background process and one standard process (I couldn’t add them to the forum because I’m new, so I hosted it on Wetransfer). I found out that when I access a local drive it is working fine in both situations. When I try to access the NFS drive, it is only working in the standard process. The background process gives me the following error:

  • Process: BackgroundProcess
  • Environment: Audax
  • Robot: Development1
  • Machine name: RPA-STU01
  • Info: The user name or password is incorrect.

RemoteException wrapping System.IO.IOException: The user name or password is incorrect.

at System.IO.__Error.WinIOError(Int32 errorCode, String maybeFullPath)
at System.IO.FileSystemEnumerableIterator1.CommonInit() at System.IO.FileSystemEnumerableIterator1…ctor(String path, String originalUserPath, String searchPattern, SearchOption searchOption, SearchResultHandler1 resultHandler, Boolean checkHost) at System.IO.Directory.GetFiles(String path, String searchPattern) at lambda_method(Closure , ActivityContext ) at Microsoft.VisualBasic.Activities.VisualBasicValue1.Execute(CodeActivityContext context)
at System.Activities.CodeActivity1.InternalExecuteInResolutionContext(CodeActivityContext context) at System.Activities.Runtime.ActivityExecutor.ExecuteInResolutionContext[T](ActivityInstance parentInstance, Activity1 expressionActivity)
at System.Activities.InArgument1.TryPopulateValue(LocationEnvironment targetEnvironment, ActivityInstance activityInstance, ActivityExecutor executor) at System.Activities.RuntimeArgument.TryPopulateValue(LocationEnvironment targetEnvironment, ActivityInstance targetActivityInstance, ActivityExecutor executor, Object argumentValueOverride, Location resultLocation, Boolean skipFastPath) at System.Activities.ActivityInstance.InternalTryPopulateArgumentValueOrScheduleExpression(RuntimeArgument argument, Int32 nextArgumentIndex, ActivityExecutor executor, IDictionary2 argumentValueOverrides, Location resultLocation, Boolean isDynamicUpdate)
at System.Activities.ActivityInstance.ResolveArguments(ActivityExecutor executor, IDictionary`2 argumentValueOverrides, Location resultLocation, Int32 startIndex)
at System.Activities.Runtime.ActivityExecutor.ExecuteActivityWorkItem.ExecuteBody(ActivityExecutor executor, BookmarkManager bookmarkManager, Location resultLocation)

  • Start Time: 02/28/2020 9:17:58 AM
  • End Time: 02/28/2020 9:18:02 AM
  • Input Values: null

Output Values: Empty

  • Has Recording: false

Is it possible that the background process is running under a different user? The other user won’t have access to the NFS and then the error is explainable. If that is the case, how can I find out which user UiPath is using?

I have changed the process so that it print the UserDomainName and the UserName. Both processes give me back the same results (UserDomainName: RPA-STU01 UserName: Administrator).

Can I test something else?

Hi Remco,

There is a possibility you changed robot credentials and you did not update in the Orchestrator. In your Orchestrator go to Robots the select the robot your using (Development1) and update credentials.

I know you had this issue a while ago, but maybe this can help someone else as well.

When you run a background process, the host identity defaults to use a local service account. To avoid this and use the credentials specified in Orchestrator, you need to add an environment variable to the machine the process is being run on. The variable you need to add is UIPATH_HEADLESS_WITH_USER with a value of True. You can read more about background processes and the local service account here: https://docs.uipath.com/robot/standalone/2023.4/user-guide/background-process-automation