Set Phone Number For Multiple Users In Active Directory Using PowerShell

In this blog post, I will show you how I set or update the phone number of multiple users in an Active Directory environment using PowerShell.

Background

If you have a large environment and you decide to assign your users a new phone number as part of an ISP change or a new rollup you probably need a fast way of doing it.

Steps

This process will use a CSV file with the user samaccount user details and the new phone number and use a PowerShell to apply the configuration.

CSV

the CSV format should look like the following sample.

user    number
user01  677544456
user02  657675675

Code

The code, below, will load the users from the CSV file and update the ipPhone Active Directory attribute for the user.

If you are using a different AD attribute, change the attribute.

Import-Csv  Numbers.csv  | ForEach-Object{set-ADUser -Identity $_.user -add @{"ipPhone"= $_.Number} -Verbose  }

Processing…
Success! You're on the list.

Posted

in

,

by