Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium


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
LVL 100

Accepted Solution

John Hurst 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.
Get your Disaster Recovery as a Service basics

Disaster Recovery as a Service is one go-to solution that revolutionizes DR planning. Implementing DRaaS could be an efficient process, easily accessible to non-DR experts. Learn about monitoring, testing, executing failovers and failbacks to ensure a "healthy" DR environment.


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 100

Expert Comment

by:John Hurst
ID: 26298025
Thank you for the update and the points. .. Thinkpads_User

Featured Post

NEW Veeam Backup for Microsoft Office 365 1.5

With Office 365, it’s your data and your responsibility to protect it. NEW Veeam Backup for Microsoft Office 365 eliminates the risk of losing access to your Office 365 data.

Question has a verified solution.

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

Background Information Recently I have fixed file server permission issues for one of my client. The client has 1800 users and one Windows Server 2008 R2 domain joined file server with 12 TB of data, 250+ shared folders and the folder structure i…
Citrix XenApp, Internet Explorer 11 set to Enterprise Mode and using central hosted sites.xml file.
This video Micro Tutorial explains how to clone a hard drive using a commercial software product for Windows systems called Casper from Future Systems Solutions (FSS). Cloning makes an exact, complete copy of one hard disk drive (HDD) onto another d…
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

577 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