[Last Call] Learn how to a build a cloud-first strategyRegister Now


Create batch file to map user folder

Posted on 2006-05-09
Medium Priority
Last Modified: 2008-01-09
Where to begin.
Company has ONE main DC, w/7 out of state servers; which run as DC's, but aren't included in the MAIN DC, only the users's exist, in their OU's according to location.

I want to create a batch file to add to the OU of the users.  I could either create a GP for each OU, but would rather have the info stored under the Profile Tab->
Profile Tab ->
User Profle
Profile Path:
Logon Script:


Home Folder
Local path:
Connect:  To:

I honestly would prefer this area User Profle
Profile Path:
Logon Script:
so Admins can see the batch file, info, etc.

How can I create a batch file, that will "carry down" to all the OU's?  The way AD is setup, is we have one main OU  called Company Users and then under that we have OU's for our 7 outer offices, as well as having OU's which DO NOT need user mapping.  So,  I'd like to create a batch file that will populate the necessary path, such as \\server\users and create the user folder according to the user logon name and their counting OU.  All the Servers use the same syntax for mapping the user folders, they're all \\servername\users and all map the L: drive.  What we've been doing is manually going to the necessary server and created the user folder.

Know there's any easy way to do this but haven't found exactly what I'm looking for on EE.  Like I said, I'd prefer the info to be entered under the User's Profile tab and would like to also know how to fill in that information automatically w/out copying the path info to each user manually.

I'll need exact scripting b/c I'm not familiar.  Thanks!
Question by:mdmcq5
  • 4
  • 3

Expert Comment

ID: 16640972
the way to go would be creating a vb-script and using the WinNT-provider , that way the OU's don't matter.

Of course , you need to know some vbs...

the 2003 commandline tool dsmod could also be handy , but you would have to dive into all the commandline options.

Expert Comment

ID: 16641265
actually - there is an easier way: (assuming you run 2003)

create a share where you want to store your profiles , set full access to everyone on the share.

in AD User&Computers go to an ou with users and select multiple users you wish to modify by clicking them and holding the CTRL-key,
or press ctrl-a if you want to modify them all.

Then right-click on the selected users and choose ' properties' .
Go to the profile tab and for the profile property type \\servername\sharename\%username%

Replace \\servername\sharename with the UNC-path where you want to store the profiles.
Windows will replace the variable "%USERNAME%"  with the logon-name of the user being processed.
Windows will create a subfolder for every user and set permissions for you.

hope this helps!
There are several properties that can be modified this way.

Author Comment

ID: 16642236
what if the folders already exist; will the settings be erased?
 [eBook] Windows Nano Server

Download this FREE eBook and learn all you need to get started with Windows Nano Server, including deployment options, remote management
and troubleshooting tips and tricks


Author Comment

ID: 16642437
I'd like the \\servername\sharename\%username% idea, but what about new user's being added to the OU, then a GP would have to be created, right?

Accepted Solution

rutten-d earned 1000 total points
ID: 16662183
sorry for the slow response

as far as I know you can't set profiles property through Group Policy.

I would create a template user , assign this template user it's homedrive and profile as \\server\sharename\%username% ,
then if you need a new user , right-click your template user and select copy.
Then put the template user in the groups that every user needs.
If you create a user that way , it will autimatically have the right profile and hmedrive and be member of the standard groups.
You can create a template user in every OU if you like , doesn't matter.

Hope this helps!

Expert Comment

ID: 16684615
hi mdmcq5,

did the template-user thing work for you?

Author Comment

ID: 16691615
yes, thanks.

Featured Post

Granular recovery for Microsoft Exchange

With Veeam Explorer for Microsoft Exchange you can choose the Exchange Servers and restore points you’re interested in, and Veeam Explorer will present the contents of those mailbox stores for browsing, searching and exporting.

Question has a verified solution.

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

So you have two Windows Servers and you have a directory/folder/files on one that you'd like to mirror to the other?  You don't really want to deal with DFS or a 3rd party solution like Doubletake. You can use Robocopy from the Windows Server 200…
Learn about cloud computing and its benefits for small business owners.
This lesson discusses how to use a Mainform + Subforms in Microsoft Access to find and enter data for payments on orders. The sample data comes from a custom shop that builds and sells movable storage structures that are delivered to your property. …
Is your OST file inaccessible, Need to transfer OST file from one computer to another? Want to convert OST file to PST? If the answer to any of the above question is yes, then look no further. With the help of Stellar OST to PST Converter, you can e…

831 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