Environment Variables

Hello guys,
I’d need to know how to get a list of environment variables both user and system

Assuming you know how to use the Fixlet Debugger, you can use the following statement to return a list of all of the system environment variables available on a Windows endpoint.

q: variables of environment

You can then retrieve the value of an environment variable by using something like this:

q: value of variable “ProgramFiles” of environment
A: C:\Program Files (x86)
T: 0.030 ms

There are more things that can be done here also, such as expanding the values of an environment string. In basic terms that means you could return the value of a registry key and have any environment variables in the string replaced with the actual value.

Check out the following inspector reference page for some more info on environment inspectors. https://support.bigfix.com/inspectors/Environment%20Objects_Any.html

As for user variables there are user objects inspectors. What exactly are you interested in finding for users?

OK thanks
I’m looking for a complete list of variables and their values User + System

You can only get the system environment variables using the inspector. The BigFix agent runs in the SYSTEM context, so it only has those environment variables available to inspect.

If the environment variables are found in the registry, which I think they are, then it might be possible to query the environment variables of all local or currently logged in users.

What is your use case? Why do you need to know the User’s environment variables?

I need to know the environment variables to replicate remotely to other computers that require the same configuration

Do you actually need to know the User environment variables, or just the System ones?

Is it just the PATH variable you need, or others?

Related:


You can set SYSTEM level environment variables with BigFix, but setting User level environment variables is much harder. You can do this with Local GPO set through BigFix.

You can read all user environment variables by reading all user keys of the registry. This is a bit of a heavy handed approach, but it can be done through BigFix.

In the registry I have the key " HKEY_LOCAL_MACHINE \ SYSTEM \ CurrentControlSet \ Control \ Session Manager \ Environment " . How can I extract and the list including a name and value of the variables listed ?

Example:

http://winaero.com/blog/wp-content/uploads/2014/07/hkcu_variables .png

I would like a list so structured:

Name - Data

TEMP - %USERPROFILE%…

(name of it & " - " & (it as string) ) of values of keys "HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Session Manager\Environment" of registry