How To Check Why A UiPath Environment Variable Changed On Its Own On Studio / Robot Machine?

How to investigate the reason why a UIPATH system environment variable is overwritten/changed "on its own"?

Issue Description: UiPath system variable value is being overwritten and the cause is not known.

As an example, the steps below are for the UIPATH_LANGUAGE variable that was changed from EN to FR without any apparent reason, but the same steps apply to all system variables.

Investigation Steps:

In order to check what is changing the environment variable, the audit logging for the registry path corresponding to this variable must be enabled.

To do this, perform the following (requires elevation):

  1. Run the following command from Command Prompt:
  • auditpol /set /subcategory:"Registry" /success:enable
Note: if the OS has a different language pack, the name “Registry” might differ. For instance, on a French Windows, the name should be "Registre".

  1. Open the Registry Editor and navigate to the key which we want to audit.
  1. For a system environment variable, go to HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Session Manager\Environment\UIPATH_LANGUAGE
  2. For a user environment variable, go to HKEY_CURRENT_USER\Environment\UIPATH_LANGUAGE.
  3. Right-click on the key, go to the Edit menu and choose "Permissions…"
  4. Click "Advanced" and switch to the "Auditing" tab
  5. Add a user or group and select Access: Set Value
  6. Apply settings
  7. Now the registry changes are visible in the Event Viewer under Windows Logs\Security.
  8. Look here to gain an insight on what is overwriting the value of this variable: