?
Solved

Add home folder path in user object to multiple users

Posted on 2006-06-07
7
Medium Priority
?
616 Views
Last Modified: 2013-12-04
I have a Windows 2003 AD domain and have to migrate to the corporatete 2000 AD domain.  All of my user objects are already created and I would like to automate or script up the home folder/directory option under the profiles tab in each users properties.  I have roughly 2000 users and would be very time consuming to manually set each one.  I need to chose the connect option and choose a letter then the path to my share.  Does anyone have a vbscript out there?
0
Comment
Question by:d_ww
  • 5
  • 2
7 Comments
 
LVL 4

Expert Comment

by:tomerlei
ID: 16857800
Hi,
You can use the command line:
net user %USERNAME% /homefolder:\\Fileserver\%USERNAME%
it will automate the drive it takes for the home folder tho.
and you can get a list of all the users in your AD into a text file by using the Active Directory users and computer tool, in the view menu hide all the columns and add the pre-windows 2000 user names, now use the import commnad to import it all into a CSV file and you got yourself all the user names into a text file.

Now for the batch scripts:

@echo off
REM This assumes that all the user names are in c:\users.txt
REM you can extract them with the method above.
FOR /F "delims=" %%a IN (c:\users.txt) DO net user %%a /homefolder:\\Fileserver\%%a
:eof

this will set the homefolders of all the users in the users.txt file to the path \\Fileserver\Username, You can change it to fit your needs.
0
 
LVL 4

Expert Comment

by:tomerlei
ID: 16857812
I'm sorry, a little fix, the command should look like this:
net user %USERNAME% /homefolder:\\Fileserver\%USERNAME% /domain
and
FOR /F "delims=" %%a IN (c:\users.txt) DO net user %%a /homefolder:\\Fileserver\%%a /domain
0
 
LVL 4

Expert Comment

by:tomerlei
ID: 16857819
And replace the import words with export,
i'm a bit tired i guess. :)
0
 The Evil-ution of Network Security Threats

What are the hacks that forever changed the security industry? To answer that question, we created an exciting new eBook that takes you on a trip through hacking history. It explores the top hacks from the 80s to 2010s, why they mattered, and how the security industry responded.

 

Author Comment

by:d_ww
ID: 16860629
Is their a way to pick a specific letter in the drop down list....for instance the letter L?
0
 

Author Comment

by:d_ww
ID: 16861053
I guess  should have been a little more specific as to what I needed.  I have a file server with a "home" share for the users files with "user" naming convention.  The new domain I will migrate to uses the "user.lastname" naming convention.  So I have created a new share on my file server named "newhome".  When I manually go to the users properties, then the profile tab, choose the connect button under the home folder option and choose a letter and then type in the path, click ok, it will create a "home folder" with the "user.lastname naming convention in the path specified (with all of the security setup).  I would like to do this for 2000 users but I would like to script or batch it up.

I tried your batch and it fills in the local path field under the home folder option in the users properties and does not create a "home folder".  This will not work with my situation.
0
 
LVL 4

Expert Comment

by:tomerlei
ID: 16861343
You can create the home folders in the batch files too, im not really sure how did you want the directory name to look like, but you can use this:

FOR /F "delims=" %%a IN (c:\users.txt) DO (
mkdir \\Fileserver\newhome\%%a
net user %%a /HOMEDIR:\\Fileserver\newhome\%%a /domain
)

and it will create each directory before linking to it.
I hope it helps you.

** The right parameter was HOMEDIR and not HOMEFOLDER, sorry for that.
0
 
LVL 4

Accepted Solution

by:
tomerlei earned 525 total points
ID: 16861542
oh, and if you'll like to delete Everyone's permission on the directory and grant only the specified user a permission:

FOR /F "delims=" %%a IN (c:\users.txt) DO (
mkdir \\Fileserver\newhome\%%a
cacls \\Fileserver\newhome\%%a /E /R Everyone /G [DOMAINNAME]\%%a:F
net user %%a /HOMEDIR:\\Fileserver\newhome\%%a /domain
)

and replace the [DOMAINNAME] with your real domain name.
0

Featured Post

2017 Webroot Threat Report

MSPs: Get the facts you need to protect your clients.
The 2017 Webroot Threat Report provides a uniquely insightful global view into the analysis and discoveries made by the Webroot® Threat Intelligence Platform to provide insights on key trends and risks as seen by our users.

Question has a verified solution.

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

Many of us in IT utilize a combination of roaming profiles and folder redirection to ensure user information carries over from one workstation to another; in my environment, it was to enable virtualization without needing a separate desktop for each…
In a recent article here at Experts Exchange (http://www.experts-exchange.com/articles/18880/PaperPort-14-in-Windows-10-A-First-Look.html), I discussed my nine-month sandbox testing of the Windows 10 Technical Preview, specifically with respect to r…
This Micro Tutorial will teach you how to add a cinematic look to any film or video out there. There are very few simple steps that you will follow to do so. This will be demonstrated using Adobe Premiere Pro CS6.
Please read the paragraph below before following the instructions in the video — there are important caveats in the paragraph that I did not mention in the video. If your PaperPort 12 or PaperPort 14 is failing to start, or crashing, or hanging, …
Suggested Courses
Course of the Month16 days, 10 hours left to enroll

864 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