- how I modify environment variables for the System user?
- Posted by bennett@peacefire.org on May 26th, 2005
How do I modify environment variables for the built-in user SYSTEM on a
Windows XP system?
I can see environment variables for the user SYSTEM by running:
AT XX:XX cmd /c "set > c:\output.txt"
where XX:XX is the next minute on the clock. (Is there an easier way
to run commands as the "SYSTEM" user? I couldn't figure out how to do
it using the "runas" command, because it prompts you for the password
of the user you want to run as, and I don't know if the built-in SYSTEM
user even has a password or if there's any way to get it.)
However, if I go to System->Advanced->Environment variables and add new
variables either to the section "User variables for Owner" or to the
section "System variables", neither one of these changes shows up if I
re-run the 'AT XX:XX cmd /c "set > c:\output.txt"' command to view
environment variables for the System user. The changes show up in my
list of environment variables, if I run the "set" command as myself,
but not in the variables for the user System.
(The problem is that I'm supporting some users who install the OpenSA
web server, and then run my script which sets up a CGI script on the
OpenSA web server and does some configuration. The script uses the
Net::SSLeay perl module, which requires two encryption DLLs that are
found in the C:\OpenSA\Apache2\bin directory, and for some reason, on
some systems the OpenSA installer doesn't add that directory to the
path environment variable for the system user, so the module doesn't
work in scripts that are loaded by (and run as) the Web server. I can
fix that if I add the C:\OpenSA\Apache2\bin directory to the path for
the System user in my installation script.)
-Bennett
- Posted by Sten Westerback on May 26th, 2005
<bennett@peacefire.org> wrote in message
news:1117075846.892933.67520@o13g2000cwo.googlegro ups.com...
Just as with any process the environment is loaded only when the process
starts. Thus you can get that to work by restarting the Scheduler or
MStaskScheduler service.
The only way to change global (=system) variables is to set them in
Registry before the processes start and you can't (without extensive
kernel mode operations) change it from the outside -- only from inside
the process itself.
Thus you would probably be better of to just do the needed processing
in the CGI script...
- Sten
- Posted by bennett@peacefire.org on May 28th, 2005
Sten Westerback wrote:
Thanks for explaining, that's consistent with what I'm seeing. I had
read there was a Windows message WM_SETTINGSCHANGE that you should
broadcast if you change a system setting (which I assume would include
the system path in the registry). Why wouldn't it cause the
applications running as the SYSTEM user to also pick up that change, or
am I missing something? Is it because applications have to actually
listen for that message for it to have any effect, and the Services.exe
process, the one that runs as the SYSTEM user and starts up services
for you, deliberately doesn't listen for it?
-Bennett
- Posted by Sten Westerback on May 31st, 2005
<bennett@peacefire.org> wrote in message
news:1117254277.959574.145290@o13g2000cwo.googlegr oups.com...
Thatäs because the message isn't covering legacy settings like environment
variables. Most modern applications just doesn't use it. What the message
says, for those apps that care to interpret it, is that something else has
changed
like system font, system colors etc -- mostly things that used to be in .INI
files.
- Sten
MVP SDK