Add home folder path in user object to multiple users

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?
d_wwAsked:
Who is Participating?
 
tomerleiCommented:
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
 
tomerleiCommented:
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
 
tomerleiCommented:
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
Protect Your Employees from Wi-Fi Threats

As Wi-Fi growth and popularity continues to climb, not everyone understands the risks that come with connecting to public Wi-Fi or even offering Wi-Fi to employees, visitors and guests. Download the resource kit to make sure your safe wherever business takes you!

 
tomerleiCommented:
And replace the import words with export,
i'm a bit tired i guess. :)
0
 
d_wwAuthor Commented:
Is their a way to pick a specific letter in the drop down list....for instance the letter L?
0
 
d_wwAuthor Commented:
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
 
tomerleiCommented:
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
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.

All Courses

From novice to tech pro — start learning today.