How to Modify Environment Variables for a Different Not Logged in User in Windows
Modifying environment variables for a logged in user is straight forward. However there are some instances when we need to modify environment variables for a different user. One frequent usage which I have come across is when we need to modify PATH variables for a service account in a CI box. Service account may not have local logon rights to the machine Or we may not know its password. Hence I always end up using below method to update path variables
Identify Security Identifier(SID)
Open command prompt and use below commands
Replace USERNAME with actual username
1
|
|
We can also find username based on SID Replace SIDNUMBER with actual value
1
|
|
Once we have the SID number of the next user, move on to next step
Modify Registry
- Open registry editore (Regedit.exe) in windows.
- Navigate to HKEY_USERS >> SID of USER>> ENVIRONMENT
- This should display all defined environment variables. We can modify all variables as we need