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

When using a service manager like srvany or nssm to run a normal program as a service, you can set the program's environment using the registry as documented here: When doing this, you need to set all the environment variables, not just the ones you want to change. Microsoft's article says, "Make sure to include all core entries like PATH, TEMP, OS, and so on." What exactly is included in "and so on" and is there a definitive reference for that information?

share|improve this question
up vote 2 down vote accepted

There's no concrete list of exactly which environment variables that you need to set. The answer is simply all the environment variables that your application/service will be using. This varies depending on the application. The particular application might only use TEMP, or it might not need any environment variables at all. Or it might use _NT_SYMBOL_PATH and will crash if that environment variable is not found! There's no way to know without knowing your application.

If you type set at the command-line, you'll be given a list of your current environment variables, which is a pretty good list to start from.

Edit: If you want to see what environment variables your current Windows services are using as an example to go by, Type this into Powershell 3:

$(Get-Process svchost)[0].StartInfo.EnvironmentVariables
share|improve this answer
Maybe I need to reword the question. I'm not so much asking, "Which environment variables does my service need?" I'm trying to ask, "Which environment variables does Microsoft consider to be 'core entries'?" – MicahStetson Nov 25 '13 at 22:03
This feels like biblical exegesis, but I think it's the TechNet article that needs to be reworded. A 'core environment variable' isn't a technical definition. They're only 'core' inasmuch as they're used by many apps and services and programs. – Ryan Ries Nov 25 '13 at 22:07
To give you something a little more tangible, let's look at a very fundamental process on a Windows system: smss.exe. If you look at it in Process Explorer, and go to its Environment tab, you will see only 3 variables: Path, SystemDrive and SystemRoot. If you look in the registry under HKEY_Users\.DEFAULT (which is essentially the Local System's profile - it isn't the default user template despite the name,) you will only see environment variables - TEMP and TMP. – Ryan Ries Nov 25 '13 at 22:17
But if you look at other processes on the system, even other processes that are running as SYSTEM as well. You might notice that they have many more environment variables. It's because those processes need them while others don't. – Ryan Ries Nov 25 '13 at 22:19

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.