Drive mapping script

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
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.

JohnBusiness Consultant (Owner)Commented:
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

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
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~~

This post should point you in the right direction.
Cloud Class® Course: Python 3 Fundamentals

This course will teach participants about installing and configuring Python, syntax, importing, statements, types, strings, booleans, files, lists, tuples, comprehensions, functions, and classes.

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.
If going to use kix.

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

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

genehuntAuthor Commented:
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?
JohnBusiness Consultant (Owner)Commented:
Thank you for the update and the points. .. Thinkpads_User
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
Microsoft Legacy OS

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.