Drive mapping script

Posted on 2010-01-12
Medium Priority
Last Modified: 2012-05-08
Hi there
My 'scripting guy' has become victim to the swine flu which has left me single handily deploying a domain.

I'd be utterly grateful if someone could help me compose a script, ideally dos command based/batch script that will query the logging on user's user name in Active Directory and will map the h: to that user's private area.

i.e. jsmith logs on script runs in Windows xp and \\servername\users\jmsith is mapped accordingly where ever the user logs on.

I'm partial to kix too but unfamiliar.

Detailed instructions would be utterly appreciated.

Kind regards
Gene Hunt
Question by:genehunt
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
LVL 97

Accepted Solution

Experienced Member earned 252 total points
ID: 26294808
Assuming that the user logs on to Windows with the same credentials as AD has for that user, then you have created the script almost yourself.

In a batch file:

NET USE H: \\servername\users\jsmith

Hope that helps. ... Thinkpads_User

Expert Comment

ID: 26294824
Dear Gene,

An easier way to avoid scripting to map a 'home' folder for your users is to set it up on the Active Directory's Object Properties.

I added an example image for your review.

It is still posible to make a script that queries the server through WMI to gather data and... but I think the easier the better.

Hope this helps~~

LVL 18

Assisted Solution

chuckyh earned 252 total points
ID: 26294825
This post should point you in the right direction.
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!


Assisted Solution

JonasLedel earned 248 total points
ID: 26296351
Some additional info on Medianoche's comment:
When specifying a home folder, you can user the %USERNAME% environment variable, which will create a folder with the username as its name. The correct permissions will also be set. If the folder exists you will receive a question asking you whether you want to apply the correct permissions.

Assisted Solution

Isorg earned 248 total points
ID: 26296414
If going to use kix.

the syntax for the kix script would be something like this.

use h: "\\server\share\" + @userid


Author Comment

ID: 26297995
Thank you all, the suggested methods all worked and i now users able to logon and map their drives :)

@Medianoche, this only seems to work users logging onto the server, not the clients. Are their additional steps required here?
LVL 97

Expert Comment

by:Experienced Member
ID: 26298025
Thank you for the update and the points. .. Thinkpads_User

Featured Post

Office 365 Training for IT Pros

Learn how to provision tenants, synchronize on-premise Active Directory, implement Single Sign-On, customize Office deployment, and protect your organization with eDiscovery and DLP policies.  Only from Platform Scholar.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

YESTERDAY YESTERDAY.BAT is inspired by a previous article I wrote entitled: TOMORROW.BAT (http://www.experts-exchange.com/OS/Microsoft_Operating_Systems/MS_DOS/A_4196-Advanced-Batch-File-Programming-TOMORROW-BAT.html). The crux of this batch f…
Citrix XenApp, Internet Explorer 11 set to Enterprise Mode and using central hosted sites.xml file.
Windows 8 comes with a dramatically different user interface known as Metro. Notably missing from the new interface is a Start button and Start Menu. Many users do not like it, much preferring the interface of earlier versions — Windows 7, Windows X…
With the advent of Windows 10, Microsoft is pushing a Get Windows 10 icon into the notification area (system tray) of qualifying computers. There are many reasons for wanting to remove this icon. This two-part Experts Exchange video Micro Tutorial s…
Suggested Courses

752 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question