← script library

Bulk Update User Phone Numbers in Active Directory

Active DirectoryJanuary 6, 2025

Keeping user contact information up to date in Active Directory is essential for effective communication within an organization. This PowerShell script allows administrators to bulk update the phone numbers of user accounts based on a CSV file. With this script, you can ensure that all user information is accurate and current. At ServerEngine, we provide intuitive tools to enhance your IT management.

powershell
Import-Module ActiveDirectory

function Update-ADUserPhoneNumbers {
    param (
        [string]$csvPath
    )
    $users = Import-Csv -Path $csvPath
    foreach ($user in $users) {
        $username = $user.UserName
        $phoneNumber = $user.PhoneNumber
        try {
            Set-ADUser -Identity $username -TelephoneNumber $phoneNumber
            Write-Host "Successfully updated phone number for user: $username"
        } catch {
            Write-Host "ERROR: Could not update phone number for user: $username. Error: $_"
        }
    }
}

Update-ADUserPhoneNumbers -csvPath "C:\Path\To\Your\phone_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.