AD telephone number updates via PowerShell
The following information provided is in reference to the following two
PowerShell scripts.
-
get_aduser_telephone.ps1
-
import_adusers_new_telephone.ps1
Problem Statement:
It is desired to use the Active Directory (AD) user telephone number field for
the new Cisco Collaboration Solution to be deployed. In the current state,
telephone numbers may be missing, formatted incorrectly, or truncated as
extensions. For the best experience to the end users, the final state should be
normalized numbers, globally unique, and dialable from any device. By
definition, the industry standard in telecommunication directory formatting is
to provide the telephone number in a +E164 format. For example the following two
numbers would be normalized as shown below:
Changing AD telephone numbers programmatically is a multi-step process. Using
the scripts referenced in this document it can be done quickly and efficiently
by following the steps as defined below.
Solution:
Export the users
-
To do this, there are few small pre-requisites. The AD search space must be
updated in the script to be restricted to where the users exist.
-
Optional: The script is currently filtering on the mail attribute being
populated. This can alternatively be modified to any other attribute
(“memberOf” for example to filter on AD groups.)
-
Run the “get_aduser_telephone.ps1” script from a machine on the network
which has Powershell installed. Once the script has been run, a new file
will be created in the directory that the script was run from. The file name
will be called “ad-user-export.csv”.
Modify the numbers
-
Make a copy of the exported file and rename it to ad-user-import.csv
-
Remove any rows which contain users which you would not want to be modified.
-
Using Excel, notepad, or any preferred text editor
-
Modify the telephone number column to be the +E164 formatted numbers.
-
note: Excel has the added benefit of using formulas to convert number,
and using advanced find and replace capabilities
-
Review the import file for errors, and make sure it is scoped to only
contain the users you would like to modify. Once you are happy, move on to
the Import step.
Import the updated user telephone numbers
-
Run the “import_adusers_new_telephone.ps1” script
-
Review the live output from the script to validate that the numbers are
indeed updating.
-
Verify in Active Directory Users and Computers.