Setting the Path on a WinNT workstation
Novell Cool Solutions: Tip
By Thomas Henkov
Digg This -
Posted: 9 Aug 2000
Current Version: ZENworks 2
This is a tip about setting the path on a Windows NT 4.0 workstation. It's relevant for the Q&A you published earlier: "Using an app object to change a registry key" by Ross I., Australia.
Here's the original Q&A:
Here are some more ideas from Cool readers:
Q: Ross I., Australia, wrote: I have (what I think anyway) is an interesting little problem. I'm trying to create an application object for a Windows NT 4 machine that can add to the path registry key (HKEY_LOCAL_MACHINE\SYSTEM\ CurrentControlSet\Control\Session Manager\Environment\Path). I have a few programs that extend the path statment, so if I just use a snAppShot to pick up the path change, it'll overwrite the user's current path (and possibly break something) rather than being able to see the change in the registry string, and just add this to the current registry entry.
Here's the problem. If I use %PATH% in the application object, it takes the user's logged in path statement which is correct, but it has all the network search drives as well. So is there anyway I can access a registry key value from inside a registry setting for the application object? Eg., if I could set this registry key as:
%HKEY_LOCAL_MACHINE\SYSTEM\ CurrentControlSet\Control\ Session Manager\Environment\ Path%;C:\MYPATHHERE would be great.
A: Unfortunately, this is not easy when using NAL. You can use a login script variable to read a registry setting and set it to an environment variable. Then, in the distribution, use the environment variable and append the new setting on the end. (See the Login script doc for more info on how to read a reg key.)
Alternately, you can use the new Environment Variables page on the app object to have the environment dynamically modified at run time of the application. (Note: this doesn't work for all applications.)
I've got the same problem as Ross. I've chosen to make a separate Application Object which sets the environment path. This object contains all the paths from the different applications. So the same object is shared by the applications which need to set a path. In this way, different objects don't overwrite other object's paths.
We've got about 150 applications, but it's only about 3-4 applications which set the path. So it doesn't slow down the WS's, neither is the path exceeding the character limit.
Another little tip: Set the path in HKCU\Environment\Path. Then it ain't necessary to reboot. And the path is added to the path from the login script.
About Ross's Tip referred to in Thomas Henkov's answer of August 9 "Setting the Path on a WinNT workstation", I wanted to let everyone know the correct way to place environment variables via ZEN. When you're wanting to actually put and/or use the variable name as opposed to resolving the variable, you have to use double %-signs. So if you're using the "Text Files" function in an application object to modify Autoexec.Bat, just use %%PATH%%. That will cause a %PATH% to be added to the file. Haven't actually tried on WinNT but works great on Win95. This is documented in the NWAdmn32 ZEN help files.
If you have any questions you may contact Bill at firstname.lastname@example.org
Novell Cool Solutions (corporate web communities) are produced by WebWise Solutions. www.webwiseone.com