Reformat telephone numbers in Active Directory

When you manage phone book information in active directory sometimes there is a need to reformat data to keep in consistent or just to make it look good. Today I was given a task to deploy new signatures throughout whole organisation. During tests I discovered that telephone number is badly formatted like:

  • +xx xxx xxx xxx(desired state)
  • +xxxxxxxxxx
  • xxxx xxxx
  • etc.

In other words – total mess.

To avoid changing dozens phone numbers manually and most likely making few mistakes I crated very simple script that performs following tasks:

  • get all users from ad that have telephonenumber attribute set
  • get rid of spaces
  • get rid of national prefix
  • insert spaces
  • insert prefix
  • update user in Active Directory

Script is below, happy updating!

 

By |2018-10-26T14:01:55+00:00October 26th, 2018|Active Directory, Powershell|0 Comments

About the Author:

I am passionate about Systems Administration. I like to face new challenges and test new environments.Windows and Linux Debian boxes (both physical and virtual) are my favourites. I like solving problems related to Windows Server roles and services as well as Linux but some distributions in particular. I'm not considering myself as Linux master but surely, I always do my best to fit the needs. On the other hand I consider myself as a Windows Server Professional and in terms of WS and Windows Desktops I always follow best practices, good advices and opinions from other admins.

Leave A Comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.