Creating home directory after user creation with csvde

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
lotveitoAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

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

Mike ThomasConsultantCommented:
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.
lotveitoAuthor Commented:
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.

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
lotveitoAuthor Commented:
I found my own solution
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
Windows Server 2008

From novice to tech pro — start learning today.