Solved

Creating home directory after user creation with csvde

Posted on 2012-04-11
3
1,206 Views
Last Modified: 2012-04-19
Hi

I want to create a lot of users by csvde. I use a script that export the information from a database, create all the users using csvde and set the initial passwords for the users using admod.

But even if csvde can set the home directory attribute of the user, it does not actually create the home folder. This is described in the answer to this question:

http://www.experts-exchange.com/OS/Miscellaneous/Q_21585832.html

Is there someone that can suggest how to make a batch script that can create these home folders? I assume it is not enouch to just create them, I would also need to set permissions correctly. (?)

I use Windows Server 2008 R2

Lars Olav Tveito
0
Comment
Question by:lotveito
  • 2
3 Comments
 
LVL 24

Assisted Solution

by:Mike Thomas
Mike Thomas earned 500 total points
ID: 37836848
When you right click a user and manually set the home drive path it creates the folder for you with the correct permissions on the share you have specified so you could simply go into an OU select ALL the users in that OU using CTRL+A, right click then select properties then select profile, tick home drive, set the letter then set the path using the %username% variable.

This should take maybe 10 seconds for each each OU you have users in.......not an ideal solution but if you have a small number of OU's might be the quickest solution......but not automated.
0
 

Accepted Solution

by:
lotveito earned 0 total points
ID: 37846715
Thank you MojoTech for your suggestion. Yes, if this was a one time import, this would be the quickest and easiest solution. For this I will give you credit. The thing is that while the initial import will be a one time thing with a gazillion users, new users will also be added regularily. My plan is that when these are added by administrative personell to the employee-database, my scripts would automatically pick up this, and add them as users in Active Directory. The glory of this greatly diminishes if someone with Admin-rights on the domain controller needs to log on and do someting each time someone have been added to the database in the personell office.

I have done some googling and found my own solution. It was easier than I thought:

wget -O C:\uimp\foldercreatelist.txt http://10.30.0.15/userimp/foldercreatelist.txt

FOR /F %%E IN (C:\uimp\foldercreatelist.txt) DO (
mkdir \\siloen\Home\%%E
)

Open in new window


The file foldercreatelist.txt is generated by the personell database, and contains one username per line. My script first picks it from the database server (using wget - which I had to install) and puts it in a local folder, then loops though the file and creates one folder for each username mentioned in the file. "siloen" is the name of the fileserver on which all Home-folders, Profile-folders and other personal stuff is kept.

My script now runs as a scheduled task.

I was expected a lot of trouble with user rights to this folder, but it seems it is not needed.  At least the users created this way and with home folders created by the above script seems to work perfectly fine.
0
 

Author Closing Comment

by:lotveito
ID: 37864768
I found my own solution
0

Join & Write a Comment

Restoring deleted objects in Active Directory has been a standard feature in Active Directory for many years, yet some admins may not know what is available.
A safe way to clean winsxs folder from your windows server 2008 R2 editions
This tutorial will walk an individual through locating and launching the BEUtility application to properly change the service account username and\or password in situation where it may be necessary or where the password has been inadvertently changeā€¦
This tutorial will walk an individual through the process of transferring the five major, necessary Active Directory Roles, commonly referred to as the FSMO roles from a Windows Server 2008 domain controller to a Windows Server 2012 domain controlleā€¦

746 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

Need Help in Real-Time?

Connect with top rated Experts

13 Experts available now in Live!

Get 1:1 Help Now