wsh script to map drives referencing domain controller.

I have a network which is run on a single domain using MS Enterprise Server 2003. The domain controls 13 separate sites which each have their own domain controllers.

My boss wants me to implement a wsh script which will allow users to log on to and use only the mapped drives specified for their particular domain controller.

In other words, the drives for each user would be mapped on the domain controller machines as opposed to mapping them on the primary domain controller

I am a novice script writer..

I need help with the script and instructions on installing it.

Please help!


Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

You should do that with Group Policies.
i am not sure if you want them to log on to the DC's. Its a security issue to not allow this.
but if yes, you have to modify the "Default Domain Controller Policy"
If they log on to normal clients, the "Default Domain Policy" counts.
browse through it and look if it can do, what you want to do :)

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
DrDAuthor Commented:
The question more specifically is this:

I have to write a scipt using WSH which I would implement using group
The script would map drives to user computers as they log on.
However, since we have one domain but a number of domain controllers (a
domain controller in each site), I need a way to map drives according to the
D.C the user is using to authenicate him/herself.
For example if a user is in Site A,using Domain controller A then the mapped
drive he/she would receive would be X:\ mapped to share A
If a user is in Site B, using Domain controller B then the mapped drive
he/she would receive X:\ mapped to share B.

The WshNetwork object allows you to map drives according to three
properties: UserName, Computer Name and UserDomain

For example to map a network drive according to User Domain would be

Set objNetwork = Wscript.CreateObject ("Wscipt.Network")
strUserDomain = objNetwork.UserDomain

If strUserDomain = "ACCOUNTING" Then
   objNetwork.MapNetworkDrive "X:", "\\fileserver01\accounting", True
Else if strUserDomain = "DEVELOPMENT" Then
   objNetwork.MapNewtorkDrive :X:",  "\\fileserver01\accounting", True
End If

However the WshNetwork object doesn't have a property to map drives
according to the Domain Controller one is trying to authenicate oneself

Does anyone have a way around this?
I know a sure fire way in Dos shell scripting

You could use this.

NET USE X: %logonserver%\accounting

This will always map the drive to the share that is attached to the server you logged on from.  Now in some cases your users may log onto a server that is not local.  If this happens then access to that drive will be slow. Hope that helps.  If you have to use a WSH script you could always launch the dos script first then call the wsh script using the logon server as a switch

Start %logonserver%\netlogon\wshscript.vbs %logonserver%

Good luck
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Windows Server 2003

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.