Initializing a User Environment Variable
Hi Everyone,
This problem is not specific to any application, but its a request we have got. The request is to set a User Environment Variable on a XP machine. This user environment variable will have a network path. This network path is being fetched from the HKCU registry, which is pre-populated.
So I have a simple package which does the following :
1. Read the HKCU registry and get the value of that particular key.
2. Populate the user environment variable with that particular variable.
The only glitch here is that all packages get installed in System Account. So the system account does not have access to User profile registries. To counter that I do the above two steps with Active Setup (There are a couple of other files that need to be installed as well, so a MSI package is essential).
So after reboot the active setup works fine and even the User Environment variable is populated if you go and see in My Computer->properties->Advanced Options. But my requestor says that the Environment Variable is not intialized. What he means is that when he opens a command prompt window (CMD) and types "set", he is unable to see the User Environment Variable which he is able to see otherwise. To see that Environment Variable using the set command he has to log off and log in once again.
My question here is, What is actually meant by initializing an environment variable? I am getting the same results as my requestor, but also when I type echo %variable% on CMD I do get to see the vale that it should be populated with and apart from that I can go and physically see that it is set. So why is it not showing using set command?
I could think of a couple of ideas to get this done, I still need to try though :
1. Kill the explorer.exe and restart it at the time of reboot when my active setup executes.
2. Get the logged on user's SID and populate the HKCU entries before reboot (not too convinced on this option).
Please advise.
This problem is not specific to any application, but its a request we have got. The request is to set a User Environment Variable on a XP machine. This user environment variable will have a network path. This network path is being fetched from the HKCU registry, which is pre-populated.
So I have a simple package which does the following :
1. Read the HKCU registry and get the value of that particular key.
2. Populate the user environment variable with that particular variable.
The only glitch here is that all packages get installed in System Account. So the system account does not have access to User profile registries. To counter that I do the above two steps with Active Setup (There are a couple of other files that need to be installed as well, so a MSI package is essential).
So after reboot the active setup works fine and even the User Environment variable is populated if you go and see in My Computer->properties->Advanced Options. But my requestor says that the Environment Variable is not intialized. What he means is that when he opens a command prompt window (CMD) and types "set", he is unable to see the User Environment Variable which he is able to see otherwise. To see that Environment Variable using the set command he has to log off and log in once again.
My question here is, What is actually meant by initializing an environment variable? I am getting the same results as my requestor, but also when I type echo %variable% on CMD I do get to see the vale that it should be populated with and apart from that I can go and physically see that it is set. So why is it not showing using set command?
I could think of a couple of ideas to get this done, I still need to try though :
1. Kill the explorer.exe and restart it at the time of reboot when my active setup executes.
2. Get the logged on user's SID and populate the HKCU entries before reboot (not too convinced on this option).
Please advise.
0 Comments
[ + ] Show comments
Answers (4)
Please log in to answer
Posted by:
kardock
14 years ago
Posted by:
michaelnowell
14 years ago
Posted by:
michaelnowell
14 years ago
Posted by:
aogilmor
14 years ago
Rating comments in this legacy AppDeploy message board thread won't reorder them,
so that the conversation will remain readable.
so that the conversation will remain readable.