Bulk user Updates in Active Directory

  1. Home
  2. Bulk user Updates in Active Directory

Return to AZ-104 Tutorial Page

We shall now learn the process for bulk user updates in Active Directory. This is where automation plays a key role in making the tedious and the long-winded extremely easy. Let us suppose you have a huge data dump of user names with email addresses and phone numbers to be updated in Active Directory. The data dump is given to you in CSV file.

Practice Test for AZ-104

At present, the users from the dump do not have those values set in Active Directory. We use the following steps to perform the bulk user updates –

  1. First, use the Import-CSV cmdlet to read in the contents of the dump file.
  2. Second step ForEach-Object cmdlet will execute the code between the curly braces for each line from the CSV file sent down the pipeline.
  3. Next, the code uses Get-ADUser with a filter to matche the ‘Name’ from the CSV file column to the name of a user in Active Directory.
  4. Then, if a match is found, then the final object is piped into the Set-ADUser cmdlet.
  5. Lastly, the Set-ADUser cmdlet updated the user’s email address and phone number based on the current entries from the ‘Email’ and ‘Phone’ columns of the CSV file.

We us use PowerShell to read in the CSV file and make the bulk update (Import-CSV .\Data_Update.csv |)

ForEach-Object {Get-ADUser -Filter “Name -eq `”$($_.Name)`”” | Set-ADUser -EmailAddress $_.Email -OfficePhone $_.Phone}

AZ-104 Online Course

Reference: Microsoft Documentation

Return to AZ-104 Tutorial

Menu