abendv_10
asked on
setting environment variables using VB
Hello,
We are thinking to migrate one of our file & print server from NetWare to Windows 2003.
In the NetWare Logon script we set a search drive which contain some batch files, exe files etc..
I like to understand how can I add path to environment using vb script.
by the way, in windows 2003, if I want to let users to run batch files from this drive, is that the way to do it ?
Thanks.
Adi.
We are thinking to migrate one of our file & print server from NetWare to Windows 2003.
In the NetWare Logon script we set a search drive which contain some batch files, exe files etc..
I like to understand how can I add path to environment using vb script.
by the way, in windows 2003, if I want to let users to run batch files from this drive, is that the way to do it ?
Thanks.
Adi.
ASKER
Hi vinnyd79,
It works but I have two problems.
1.This script add the path ";C:\MyPath" Everytime I logon in addition to the same path that allready exist from the last logon. then the Environment variables PATH has more and more ";C:\MyPath".
2. To execute this script the users must be Administrators on the Machine. In Terminal Server Environment it is a big
problem.
Correct me if I worng.
any way you helped me and I give you the points.
I will be hapy for more advices.
Adi.
It works but I have two problems.
1.This script add the path ";C:\MyPath" Everytime I logon in addition to the same path that allready exist from the last logon. then the Environment variables PATH has more and more ";C:\MyPath".
2. To execute this script the users must be Administrators on the Machine. In Terminal Server Environment it is a big
problem.
Correct me if I worng.
any way you helped me and I give you the points.
I will be hapy for more advices.
Adi.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
The Error is "Permission denied"
code: 800A0046
code: 800A0046
Dim objShell,objEnviron
Set objShell = CreateObject("Wscript.Shel
Set objEnviron = objShell.Environment("Syst
objEnviron.Item("Path") = objEnviron.Item("Path") & ";C:\MyPath"
Set objEnviron = Nothing
Set objShell = Nothing