Search Windows and Linux Networking

Wednesday, October 13, 2010

how to create multiple users in active directory using dsadd command

Create OU, Group, Users in Active Directory Domain.


There are some limitation when creating the user account using net user command like if you want to create in different OU or you want to assign the user that are in different group member ship . There is the other command that can be able to do all this requirement this is dsadd user command. Using dsadd user you can able to create user in particular OU with other group membership .

         Using help of excel file you can do batch file to create multiple user with different settings .

Create excel file like this:- Useradd_sample

Now field the data in file you want to implement in particular sheet like
OU name,
Group name,
user information like user name , password and other settings.,
home directory etc.

Sample file:- useradd_script.xls  

Now Crate batch fill as :- 
Create_OU.bat
Create_Group.bat
Create_home.bat
Create_users.bat
Set_Profile.bat
Set_Permission.bat


Running Batch files.


Now run these file like these step first run Crate_OU.bat then Create_Group.bat then Create_home.bat

than Create_users.bat , then Set_Permission.bat and at last run Set_Profile.bat


This will create users automated in particular OU, Group and profile setting and also set permission to home directory

Wednesday, October 6, 2010

How to create multiple users in Active Directory

To create multiple user account in Active Directory. There are many way to do this some of them are using :-
  1.  LDIFDE
  2.  Batch file (Using command net user add or  DsAdd User)
  3. VBScript

I will show how to create multiple user using excel .



Using Batch file.(Using Net command )

Preparing for batch file.
Open the excel and create file:-

In First row type the basic header to use in our batch file

Sr.No FirstName   LastName   UserName   Password    PasswordExpire 

Description  HomeDirectory    ProfileDirectory

E.g.
 
https://spreadsheets.google.com/ccc?key=0AlEFxdGpo-1EdHRKU2hncDZBTU13WGlzWlpZczc2NXc&authkey=CMO_5rAD&hl=en#gid=0


Now type the user's information in excel file
Type only FirstName, LastName and PasswordExpire field if you want to automatically set other field like UserName and password , HomeDirectory and ProfilePath.


E.g :- 
FirstName :- "Sandeep" 
LastName :- "Kapadane"


https://spreadsheets.google.com/ccc?key=0AlEFxdGpo-1EdFh0b0FZRG1JOG1iTVl0Z0cyVTNNNUE&hl=en&authkey=CJPV3cwE#gid=0


Now use the function to get use name

UserName =first Later of FirstName + LastName
Function in excel to get result is:-  
=CONCATENATE(LEFT(B2,1),C2)
 
so in my example UserName Will be skapane

https://spreadsheets.google.com/ccc?key=0AlEFxdGpo-1EdHFZdzJhNzdCQzRjSzlMMk14M3AwZ1E&hl=en&authkey=CMfZofEC#gid=0


Now drag the formula at the end of user list.

https://spreadsheets.google.com/ccc?key=0AlEFxdGpo-1EdF9mN0RPV01fNlY0ZVk5dDQ1UFR1VkE&hl=en&authkey=CMqD15QL#gid=0

Do Same for password , In my example 
Password=First three Later of UserName + @ +Sr.No of user.+ 2010

=CONCATENATE(LEFT(D2,3),"@",A2,2010)
and drag it at the end of user list.

https://spreadsheets.google.com/ccc?key=0AlEFxdGpo-1EdGlrYXZrVEU0NXc5ZDRVTUVFeUdpbXc&hl=en&authkey=CPGQ84AI#gid=0 

Set home directory and Profile directory same as UserName
For Home Directory =CONCATENATE("\\server\users\"D2)
For Profile Directory = CONCATENATE("\\server\Profiles\"D2)
and drag it at the end of user list.

in my example it is \\Server\Users\skapadane
https://spreadsheets.google.com/ccc?key=0AlEFxdGpo-1EdFhWdnQxTXB0NmhEYjFjMmNKOHM3LVE&hl=en&authkey=CLaHg4kI#gid=0

Now we will start to actually create batch file  using Net user Command

Net user Command does not create home directory and profile directory that's why we need to create three bat file for home directory mkhome.bat , for Profile directory mkprofile.bat and last one for user add useradd.bat

Now user Net sheet to create home Directory and use function
=CONCATENATE("mkdir ", Sheet1!H2) and drag it at the end of user. 


Do same for Profile Directory and use function 
=CONCATENATE("mkdir ",Sheet1!I2) and drag it at the end of user.

And now last for new user use the function 

=CONCATENATE("Net user"," ",Sheet1!D2," ",Sheet1!E2," ","/add"," ","/comment:",Sheet1!G2," ","/Expires:",Sheet1!F2," ","/homedir:",Sheet1!H2," ","/Profilepath:",Sheet1!I2," ","/Domain")
and drag it at the end of user.

https://spreadsheets.google.com/ccc?key=0AlEFxdGpo-1EdHo3bnVvVjhtRHhrbkJoZlpRaTEtZFE&hl=en&authkey=CNnTu5cF#gid=0

Now Select sheet mkhome and select the column copy it and past it in new Notepad and save the file as "Mkhomedir.bat"

Now Select Sheet mkprofile and select the column copy it and past it in new Notepad and save the file as "Mkprofile.bat"


Do Same for last sheet user add select the column copy it and past it in new Notepad and Save the file as "NewUser.bat"

Runing The batch file 
Run "MkHomeDir.bat" on double clicking on it . This will create home directory of user you are going to create.
Then Run "MkProfile.bat" on double clicking on it .This will create Profile directory of user you are going to crate. 
After that run "NewUser.bat" on double clicking on it . This will create new users in your domain in default Users container   
(Note: if you have given space in description you should use " description " to work )

Also see:-
Useing DSAdd User 
Using VBScript.


  

   

Monday, October 4, 2010

Windows Active Directory

Here is the PPT for Active Directory to know

Active Directory Introduction
Active Directory Basics
Components of Active Directory
Active Directory hierarchical structure.
Active Directory Database.
Flexible Single Master Operations (FSMO)Role
Active Directory Services
SOME USEFUL UTILITY


https://docs.google.com/present/edit?id=0AVEFxdGpo-1EZGNtcWJ3ZnhfMTA1NmR4cmY1OWho&hl=en


Following are the topic link you may interested :-

1) Search all disabled users from Active directory.
2) Creating Multiple Users in Active Directory using excel file and VbScirpt.
3) Search (find) user in Active directory with First and Last Name using VbScirpt.
4) Export all users in Excel file from Active Directory. 
5) Update or Modify Users information in Active Directory from Excel file.