Solved

Creating home directory after user creation with csvde

Posted on 2012-04-11
3
1,280 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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

Featured Post

Efficient way to get backups off site to Azure

This user guide provides instructions on how to deploy and configure both a StoneFly Scale Out NAS Enterprise Cloud Drive virtual machine and Veeam Cloud Connect in the Microsoft Azure Cloud.

Question has a verified solution.

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

A project that enables an administrator to perform actions within a user session context not just at the time of login but any time later on day(s) or week(s) later.
Active Directory security has been a hot topic of late, and for good reason. With 90% of the world’s organization using this system to manage access to all parts of their IT infrastructure, knowing how to protect against threats and keep vulnerabil…
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 Micro Tutorial hows how you can integrate  Mac OSX to a Windows Active Directory Domain. Apple has made it easy to allow users to bind their macs to a windows domain with relative ease. The following video show how to bind OSX Mavericks to …

705 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