• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 1342
  • Last Modified:

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
0
lotveito
Asked:
lotveito
  • 2
2 Solutions
 
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.
0
 
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.
0
 
lotveitoAuthor Commented:
I found my own solution
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.

Join & Write a Comment

Featured Post

Get expert help—faster!

Need expert help—fast? Use the Help Bell for personalized assistance getting answers to your important questions.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now