Generating an AD Users report with phone numbers split into area code and number
Summary: This article contains step-by-step instructions on how to get the AD Users report where user phone numbers are split into area code and the number itself. The area code and the phone number will be displayed in different columns and will have only digits.
Applies to: Cayosoft Administrator 7.x or later.
Configuration
In the Cayosoft Administrator Console, create the AD Users rule.
Configure Limit Scope and Query criteria.
Copy and paste the script below to Properties to display.
-
This script will add the AreaCode and PhoneNumber columns to the report and remove dashes, spaces, brackets, single quotas and dots from the number:
CopySamAccountName~User Logon Name,UserPrincipalName~User Principal Name,telephoneNumber~AreaCode~`$phone=`$_.'telephoneNumber';`$phone=`$phone.Replace('-'_comma_'').Replace(' '_comma_'').Replace('('_comma_'').Replace(')'_comma_'').Replace('.'_comma_'');PSFirst `$phone3,telephoneNumber~PhoneNumber~`$phone=`$_.'telephoneNumber';`$phone=`$phone.Replace('-'_comma_'').Replace(' '_comma_'').Replace('('_comma_'').Replace(')'_comma_'').Replace('.'_comma_'');PSLast `$phone7 Save changes.
Result before script
User phone numbers before the script is applied:
Result after script
User phone numbers after the script is applied.
NOTE: The expected phone number format is (727) 439893.
Comments
0 comments
Please sign in to leave a comment.