Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I am looking for prove or disprove of my theory. We have windows service which runs under LocalSystem account. the service is calling msbuild and builds csproj (Visual Studio project) file, which use Environment variable. But its falling as it cant recognize or find that environment variable.

Is there way how I can test or assure that win service running under LocalSystem has access to environment variables?

share|improve this question
up vote 2 down vote accepted

If your environment variables are changing and you're running the service (as LocalSystem) in Windows Server 2003, XP, or 2000 then you might be running into the case that you need to restart the machine in order for the service manager to reread the environment. See this KB article for more info.

There's a hotfix available for Windows Server 2003 that will resolve this.

share|improve this answer
thanks for tip. Restarting helped. Any idea if the same applies to windows server 2008? – Jaroslav Urban Jul 21 '11 at 9:28

Programs running as LocalSystem will have an environment built from the variables specified at "HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Session Manager\Environment" and at "HKEY_USERS.DEFAULT\Environment". Make sure the variables you want it to "see" are defined in one of those locations and they will be accessible.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.