How to update multiple user details in active directory ?

Sandip Sasturkar 0 Reputation points
2023-08-29T10:27:04.4333333+00:00

Update user details of AD

Windows for business Windows Client for IT Pros Directory services Active Directory
0 comments No comments
{count} votes

4 answers

Sort by: Most helpful
  1. niloufar kianfar 20 Reputation points
    2023-08-29T11:09:12.48+00:00

    Updating multiple user details in Azure Active Directory (AD) can be done using PowerShell scripts, Microsoft Graph API, or Azure AD Connect with a CSV file. You can run this code in the powerShell to do the needed update

    1. Install AzureAD PowerShell module: #Install-Module -Name AzureAD
    2. Connect to Azure AD as an administrator: #Connect-AzureAD
    3. Create a CSV file with columns containing the user details you want to update. Make sure to include at least the "UserPrincipalName" (UPN) and the attributes you want to update:

    #UserPrincipalName,DisplayName,Department

    #******@domain.com,New Display Name,IT

    #******@domain.com,Updated User,HR

    1. Use this PowerShell script to read the CSV file and update user details:
    $users = Import-Csv -Path "C:\path\to\users.csv"
    
    foreach ($user in $users) {
        $userPrincipalName = $user.UserPrincipalName
        $displayName = $user.DisplayName
        $department = $user.Department
    
        Set-AzureADUser -ObjectId $userPrincipalName -DisplayName $displayName -Department $department
    }
    
    
    1. Discount from the AD: #Disconnect-AzureAD
    2 people found this answer helpful.

  2. Anonymous
    2023-08-30T03:54:42.1933333+00:00

    Hi,

    The csv file should contain a filed like distinguished name or SAM account name that you use to identify a user and the user properties need to be updated. It could be something like this:

    "SamAccountName","title","mail"
    
    "GlenJohn","director","******@fabrikam.com"
    

    Once the CSV file is created you can use the set-aduser cmdlet to update the properties.

    Import-Csv -Path "C:\filepath\file.csv" | foreach-object {
        Set-ADUser -Identity $_.SamAccountName -Replace @{title=$_.title;mail=$_.mail}
    }
    

    https://learn.microsoft.com/en-us/powershell/module/activedirectory/set-aduser?view=windowsserver2022-ps

    Best Regards,

    Ian Xue


    If the Answer is helpful, please click "Accept Answer" and upvote it.

    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.

    1 person found this answer helpful.
    0 comments No comments

  3. Jadav Netra Piyush 0 Reputation points
    2023-08-29T10:45:01.6433333+00:00

    create a user template by specifying the required permissions and create a CSV file containing the names of the users


  4. Matt roberts 5 Reputation points
    2023-08-30T13:47:06.7666667+00:00

    If you want an alternative to PowerShell check out this GUI tool.

    https://activedirectorypro.com/how-to-bulk-modify-ad-user-attributes/

    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.