Thursday, 22 August 2013

Microsoft: Bulk Active Directory ( AD ) Account Creation

Follow the steps below for the bulk AD account creation:

1. Create a CSV file in Excel with the following columns: -
    a. FirstName
    b. LastName
    c. SamAccountName
    d. Description
    e. Password
    f. Department

2. Save the CSV file as test.csv

3. Run the following powershell command after changing the bold statement in your AD server: -

Import-Csv C:\test.csv | foreach-object {
$userprinicpalname = $_.SamAccountName + "@domain"
$name = $_.FirstName + " " + $_.LastName
New-ADUser -SamAccountName $_.SamAccountName -UserPrincipalName $userprinicpalname -DisplayName $name -Name $name -GivenName $_.FirstName -SurName $_.LastName -Path "OU=Users,OU=UK,DC=domain" -AccountPassword (ConvertTo-SecureString $_.Password -AsPlainText -force) -Enabled $True -Department $_.Department -Description $_.Description -Manager $_.Manager -PasswordNeverExpires $True -ChangePasswordAtLogon $False -PassThru
Add-ADPrincipalGroupMembership -identity $_.SamAccountName -memberof "member1","member2","member3"}

1 comment:

  1. If you are looking to buy Facebook accounts bulk from a verified and reputable digital agency, choose Alpha Ads Agency for stable ad accounts, quality services, 24/7 support, and experienced teams' help to businesses and individuals scale their online business. Contact us at (+852) 56394802 now.

    ReplyDelete