Freigeben über


Testing AADConnect Part 3 - Users? Yes we need them

In previous posts we created Virtual machine and installed AD DS on it now we are ready to Sync.

But what would you sync? We need AD objects to Sync. Ok let's creat100 users manually well we don’t have time for that, do we?

I will help you easily create any number of users.

Create a CSV file like shown below and save it as 1.csv. Import this CSV to your virtual machine and have it under the PowerShell default directory

c-1

Open Powershell and run the below command to import the ActiveDirectory Module

import-module ActiveDirectory

Run the below script to display the entries, I usually do this to very if the script is working fine and is able to read the items just fine. (Change the domain name from praveen.local to your domain in the below script)
Import-Csv .\1.csv | foreach-object {
$SamAccountName = $_.FirstName + "." + $_.LastName
$SamAccountName = $SamAccountName.ToLower()
$userprinicpalname = $SamAccountName + "@praveen.local"
$displayName = $_.LastName + ", " + $_.FirstName
Write-host "SAM is" $SamAccountName
Write-host "UserPrincipalName is" $userprinicpalname
Write-host "DisplayName is" $displayName
}

Once you get proper Output for the above script we are ready to create users. Use the below script to Create all users in one go. Note: You can modify the CSV if you want to give custom names to users

Import-Csv .\1.csv | foreach-object {
$SamAccountName = $_.FirstName + "." + $_.LastName
$SamAccountName = $SamAccountName.ToLower()
$userprinicpalname = $SamAccountName + "@praveen.local"
$displayName = $_.LastName + ", " + $_.FirstName
New-ADUser -SamAccountName $SamAccountName -UserPrincipalName $userprinicpalname -Name $displayName -DisplayName $displayName -GivenName $_.FirstName -SurName $_.LastName -Department "Test" -Path "CN=Users,DC=praveen,DC=local" -AccountPassword (ConvertTo-SecureString "YourPass!" -AsPlainText -force) -Enabled $True -PasswordNeverExpires $True -PassThru
}

c-2c-3
Ok, we are done with the basics and we are all set to install and configure AAD Connect. Oh, Ya !

Praveen Kumar E

signature-picture

Comments

  • Anonymous
    February 08, 2017
    comment