Creating-users-with-windows-powershell

I dont want start with what is AD?
But on high level Active Directory is a special-purpose database or directory which is designed to handle a large number of read and search operations.

You can create users using different options.
1. Using UI
To open Active Directory Users and Computers, click Start, click Control Panel, double-click Administrative Tools, and then double-click Active Directory Users and Computers.
2. Command line>
dsadd userUserDN [-samidSAMName] -pwd {Password|*}
3. VB Script
4. Powershell Script

Example


    New-ADUser MyUser -OtherAttributes @{title="director";mail="[email protected]"}

Copy and Try it

Windows PowerShell is a powerful tool for performing and automating administrative tasks in Windows Server 2008.


5. Powershell Script
Creating bulk users in Active directory for Test user.
We had a csv file which had all the users with AD information in it, the Format of that csv file.

Example


Import-Csv .\usercreationfile.csv | foreach-object 
    { 
        $userprinicpalname = $_.SamAccountName + "@{domainname}.com" 
        New-ADUser -SamAccountName $_.SamAccountName -UserPrincipalName $userprinicpalname -Name $_.name -DisplayName $_.name -GivenName $_.cn -SurName $_.sn -Department $_.Department -Path "CN=Users,DC=biogen,DC=com" -AccountPassword (ConvertTo-SecureString "Microsoft~1;" -AsPlainText -force) -Enabled $True -PasswordNeverExpires $True -PassThru 
    }

Copy and Try it