Monday, January 06, 2025

Win10 modify environment variables for a different user

Problem:

Working in an environment where administrative access to the local PC was unavailable.  Local admin access was only available temporarily by elevating access with another local account. 

Found I needed to set and later remove a user environment variable SSLKEYLOGFILE.

When opening the System Properties app and then Environment Variables using the local admin credentials I found setting and deleting the variable was user specific and was being set for the local admin account that couldn't be used for interactive login.  The variable did not affect my account that I used for normal business.

Fix:

First, I needed to find the SID of my real user:

wmic useraccount where name="my_usual_username" get sid

Then I needed to open the registry editor via regedit.  I was allowed to do this via the local admin account.

I found the user specific environment variables are held in HKEY_USERS\the_sid_you_were_returned_above\Environment.

From there you can add and delete environment variables for any of the accounts that exist on the PC.


No comments:

Post a Comment