← script library

Bulk Update Active Directory User Attributes

Active DirectoryJanuary 5, 2025

Keeping user attributes up to date is essential for effective IT management. This PowerShell script allows administrators to bulk update specific attributes for multiple Active Directory users, streamlining the process and ensuring data accuracy. At ServerEngine, we are committed to providing reliable tools that simplify server management.

powershell
Import-Module ActiveDirectory

function Update-ADUserAttributes {
    param (
        [string]$csvPath
    )
    $userUpdates = Import-Csv -Path $csvPath
    foreach ($user in $userUpdates) {
        $username = $user.UserName
        # Prepare the attributes for updating
        $attributes = @{
            Title      = $user.Title 
            Department = $user.Department
        }
        try {
            Set-ADUser -Identity $username @attributes
            Write-Host "Successfully updated user: $username"
        } catch {
            Write-Host "ERROR: Could not update user: $username. Error: $_"
        }
    }
}

Update-ADUserAttributes -csvPath "C:\Path\To\Your\user_updates.csv"

Run it across your fleet

This script runs as-is on a single host. Paste it into ServerEngine to schedule it, run it on a whole server group in parallel, and keep the credentials out of the file — see the scripts documentation and the credential store.

Ready when you are.

Try ServerEngine free for 7 days.