Configure another user's environmental variables?

willsullivan 21 Reputation points
2021-10-26T14:43:26.237+00:00

We have an installer that's setting up a windows service that runs under a different user account, and it's going to be configured with some pretty sensitive values we'd like to protect as well as possible.

We'd like to store those values in the user's environment variables, but the user running the installer is not always going to be the user under which the service runs.

I'm not finding much information online about user A configuring environment values for user B. Is it possible?

C#
C#
An object-oriented and type-safe programming language that has its roots in the C family of languages and includes support for component-oriented programming.
10,307 questions
0 comments No comments
{count} votes

Accepted answer
  1. Bruce (SqlWork.com) 56,931 Reputation points
    2021-10-26T15:12:14.52+00:00

    It’s doable. The variables are stored in the registery under the users profile/Environment. You will need to get Sid of the user so you can find their entries in the registers. Then you can update.

    A better approach would be to create application registery entries, and set the permissions on them to the desired account.

    1 person found this answer helpful.

0 additional answers

Sort by: Most helpful