Re: Mapping drives and adding to the path

From: David Wang [Msft] (someone_at_online.microsoft.com)
Date: 05/25/04


Date: Tue, 25 May 2004 02:53:43 -0700

Please be absolutely certain that the PATH registry key stay as
REG_EXPAND_SZ or else the %environment-variables% won't resolve, and PATH
behavior will appear broken.

You will need to run with the elevated privileges of the Group Policy login
script instead of the logged-on user to make these modifications.

-- 
//David
IIS
This posting is provided "AS IS" with no warranties, and confers no rights.
//
"Niclas Lindblom" <nospam.lindblom_niclas@hotmail.com> wrote in message
news:ugZRBUZQEHA.3380@TK2MSFTNGP11.phx.gbl...
You are right, the value is store in the registry in the key
HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Session
Manager\Environment\PATH
as an expandable string value
Perhaps you can use the REG command to manipulate this key (belive this
comes with the resource kit), or the shell object if you want to use VB
script.
Here is a sample on how to add a folder to the path using VB Script:
'##SCRIPT START
Dim oShell
Dim oEnvironment
Dim sCurValue
Set oShell=CreateObject("wscript.shell")
sCurValue=oShell.Environment.Item("PATH")
Set oEnvironment=oShell.Environment("System")
oEnvironment("PATH")=sCurvalue & ";c:\myNewPath"
'##SCRIPT END
Also looks like you can do this the old style way in Autoexec.bat, according
to: http://support.microsoft.com/?kbid=100843
Regards
Niclas
<anonymous@discussions.microsoft.com> wrote in message
news:1162301c4418c$3567abb0$a501280a@phx.gbl...
>I have tried that method, but it only works for the
> command prompt sessions that it is run within. If I run
> another command prompt, the PATH has not been added to.
> Is there a method to add to the 'system' PATH variable.
>
> I believe that's stored in the registry, but the users
> logging on do not have rights to modify that part of the
> registry.
>
> Iain
>
>>-----Original Message-----
>>the command from a commandline to add environment
> variables is SET. type SET
>>/? for options. I am not aware of a way to test group
> membership from a
>>commanline script, but you might be able to find a 3rd
> party utility to do
>>this, or use VB scripts instead for more flexibility.
>>
>>Good luck
>>
>>Niclas Lindblom
>>
>>
>>"Iain M" <anonymous@discussions.microsoft.com> wrote in
> message
>>news:112de01c4417f$6b659d10$a301280a@phx.gbl...
>>> I'm migrating from Netware to Windows 2003, and I have a
>>> couple of questions about login scripts. I'm using
> a .BAT
>>> file deployed using group policy.
>>>
>>> - I can map drives using NET USE in the group policy
> login
>>> script. How can I add a network drive to the PATH ?
>>>
>>> - how do I test if a user is a member of an Active
>>> Directory group ?
>>>
>>> Any help appreciated.
>>>
>>> Iain
>>
>>
>>.
>>


Relevant Pages

  • Re: Modify Registry on all SBS2003 clients
    ... registry setting to all workstations. ... command "REG ADD" to modify registry. ... the following command will change the registry value as your ... You may copy above command into the login script file SBS_LOGIN_SCRIPT.bat ...
    (microsoft.public.windows.server.sbs)
  • Re: Modify Registry on all SBS2003 clients
    ... registry setting to all workstations. ... command "REG ADD" to modify registry. ... the following command will change the registry value as ... and put the command lines at the bottom of the script file. ...
    (microsoft.public.windows.server.sbs)
  • Re: Applying group policy via VBScript
    ... I think the point here is that these registry values are exactly what GP was ... HKLM, that means that if you wrote a script, the HKLM changes would need to ... capabilities of Group Policy ADM templates, ... the policy keys are only cleaned up when they are ...
    (microsoft.public.windows.group_policy)
  • Re: Expected Statement error
    ... or something from a command line 'For' loop (my DOS knowledge is ... The OP is trying to alter the registry to create a file ... approach manually and the registry hack in a script. ... script, i have a .REG file that i know works on the PC's, maybe this ...
    (microsoft.public.scripting.vbscript)
  • Re: Applying group policy via VBScript
    ... I think the point here is that these registry values are exactly what GP ... HKLM, that means that if you wrote a script, the HKLM changes would need ... capabilities of Group Policy ADM templates, ...
    (microsoft.public.windows.group_policy)