when running the process by de Robot, in a Windows Server 2016, it can’t access the Environment Variable CLIENTNAME.
the extrage thing is that I’m running a CMD with the SET command, and I can see the variable.
But the robot cannot see it.
I also tried to see all the variables with a loop over the System.Environment.GetEnvironmentVariables, and there are some others variables that I can not se besides the CLIENTNAME, like the SESSIONNAME.
But I can see them with the SET command in CMD.
Welcome to the Community!
It might be related to fact that windows is applying some variables differently to some processes. Here’s is quite old document about it:
You may try to use powershell method to get this to work.
We’ve already check that old article from MS. And no, this is not the situation.
We’ve already tried access the variable by:
- CMD command “SET”
- Powershell command “Get-ChildItem Env:CLIENTNAME”
- UiPath Activity “GetEnvironmentVariable”
- .Net code “Environment.GetEnvironmentVariable(“CLIENTENAME”)”
All of the above works perfectly manually, one of the above works.
The problem is as follows:
The Service Mode Robot Service (SCM-managed)** (UiPath.Service.Host.exe), Runs under the Local System.
Hence, the Local System cannot access directly to the Environmetn Variable CLIENTNAME.
Because this variable is saved in the Registry under the User’s Volatile Environment variables.
In orther for us the get the value of a User Env. Variable, we need to Query de registry either by powershell or cmd script, and get the value.
Indeed. It’s exactly what I wrote
This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.