Link to home
Start Free TrialLog in
Avatar of Gary Gordon
Gary GordonFlag for United States of America

asked on

Need to add drive on 2 pcs in domain via vbs script

I have 2 PCs in my domain that must have a mapped drive available every time they start.   As numerous employees use there 2 PCs, the mapped drive often gets disconnected.

I need for both PCs to load these drives every time the PC starts.  I made a vbs script that creates the drive when I run it but I have not been successfull in getting this configured right to start automatically.

Any advice would be greatly appreciated.

Avatar of wjester
wjester

add the script to the startup group on each computer (the 'all users' startup group).
Avatar of Gary Gordon

ASKER

how?
ASKER CERTIFIED SOLUTION
Avatar of wjester
wjester

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of arnold
ADd a script to be executed when the user logins to the user's AD setting
i.e. mapdrive.bat

The mapdrive.bat will include the following
@@echo  

net use Z: \\shareserver\sharepoint

------

Whenever a user whose AD profile references the mapdrive.bat script logs in, they will have drive Z pointing to that share.

You need to put that mapdrive.bat file in the domain\netlogon\scripts share location on the domain controllers.  I think adding it to one will create it on the others if any.
since this is only for 2 PCs and you want it based on the computer, not on the user, I would just add it to the startup group. you could create a GPO to run the script based on the computer, but that seems overly involved for what you're looking for.
dead on
Partially misinterpreted your question.  Using centralized management through group policy, you can add both computers into a group whose logon script will reference the same mapdrive.bat file.

http://www.microsoft.com/downloads/details.aspx?FamilyID=0A6D4C24-8CBD-4B35-9272-DD3CBFC81887&displaylang=en

The group policy will have the user configuration\windows settings\scripts(logon\logof).  Double click on logon.  Click on show files.
Create the mapdrive.bat file there. Close the directory. Click add in the logon properties window. Type mapdrive.bat in the script name and click ok.

when the policy propagates those two systems will map the drive upon logon.