Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I'm exploring environment variables via the WMI class Win32_Environment. According to the documentation, a variable that's not of a specific user can be either a "System" variable or a "Default User" variable. My question is, what's the difference, and how I would use one or the other?

Exploring a Windows 2008 machine that's being used as a workstation, I find System variables, but no Default User variables.

share|improve this question

3 Answers 3

up vote 5 down vote accepted

The SYSTEM variables are those stored in:

HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Session Manager\Environment

The <DEFAULT> variables are those stored in:

HKEY_USERS\.DEFAULT\Environment

The .DEFAULT user is not the default settings that are created when a user's profile is created for the first time. Rather, .DEFAULT is the HKEY_CURRENT_USER environment used by the LocalSystem security context.

Here's some background from Raymond Chen's blog to give my answer some addt'l credibility: http://blogs.msdn.com/oldnewthing/archive/2007/03/02/1786493.aspx >smile<

share|improve this answer
1  
So, in short, <DEFAULT> variables are just user variables for the LocalSystem pseudo-account, correct? –  JCCyC Jul 7 '09 at 17:34
    
Yes, that is correct. –  Evan Anderson Jul 7 '09 at 17:48

I'm not quite sure on this one, but most likely the system variables will be available all the time, wherease the Default User variables only apply as long as the user has not overwritten them.

share|improve this answer
1  
Dang; I was writing an answer that you summed up so much easier. Yes, System is system wide, default is persistent until the user changes 'em and user is, well, for that user. As for no default in 2K3, I think its hidden in registry. The GUI doesn't give the option to change defaults unless its a terminal server. This is mainly because you don't have a lot of general users logging into a server (or shouldn't, at least). Since I can't find anything to backup my statement, I'd consider that just a theory. –  drgncabe Jul 7 '09 at 16:14
    
@towo: Though it might seem intuitive, this is not correct. –  Evan Anderson Jul 7 '09 at 16:21
    
Do you mean, if there's a "PATH" variable for user joeblow, it'll be ignored in favor of the System variable "PATH"? –  JCCyC Jul 7 '09 at 17:29
1  
PATH is special. If you set that in a user's registry the entries will be appended to the system path. What I was saying re: this being incorrect relates to the ".DEFAULT" entries "being overridden". The ".DEFAULT" entries are only used by the SYSTEM context. Setting a value in a user's enviroment will override the value specified in the system environment (but has nothing to do with the .DEFAULT values). –  Evan Anderson Jul 8 '09 at 3:08

Not entirely sure....I would assume System variables are system wide, and there is only 1. Default User variables get set for each user, by default, but are independent of each other. Thus in terminal services for example user a can set his tmpdir to something other than user b but both start with the same value set by the default user.

share|improve this answer

Your Answer

 
discard

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.