Search Specific Lync Phone Number(s)

Any Lync admin that manages enterprise size environments will frequently find the daily need to search a phone number and figure out what it is.  Or you could search part of a phone number and get all accounts that match.

The following script prompts the admin to enter any part of a phone number.  Normally, I would under the the 10 digits (US based) to search.  However, you can search for any amount of digits within the number.  For Example if a Common Area Phone has a Line URI of Tel:+12223334444;ext=4444 you can search for 12223334444, 3334444, 4444, 222333, etc.

When a number is found it will spit out a description of the object type, it’s SIPAddress, LineURI and SamAccountName.  For Example:

singlenumber

 

#Written by Jeff McBride | www.lynclead.com
#Switched from Where Object to Filters to increase response time
#v4 2/11/2015 - added CSMeetingRoom
$WarningPreference = "SilentlyContinue"
$NumberInQuestion = Read-Host "What is the number in question"
$NumberInQuestionLike = "*$NumberInQuestion*"
$starttime = get-date
foreach ($AccountType in ($NumberInQuestion))
{
Get-CSUser -Filter {LineURI -like $NumberInQuestionLike} | Select User_LineURI,SipAddress, DisplayName, LineURI, SamAccountName
Get-CSUser -Filter {PrivateLine -like $NumberInQuestionLike} | Select Private_Line,SipAddress, DisplayName, LineURI, SamAccountName
Get-CSCommonAreaPhone -Filter {LineURI -like $NumberInQuestionLike} | Select CommonAreaPhone,SipAddress, DisplayName, LineURI, SamAccountName
Get-CSAnalogDevice -Filter {LineURI -like $NumberInQuestionLike} | Select AnalogDevice,SipAddress, DisplayName, LineURI, SamAccountName
Get-CSRGSWorkflow | ? {$_.LineURI -match $NumberInQuestion} | Select RGSWorkFlow,SipAddress, DisplayName, LineURI, SamAccountName
Get-CSEXUMContact -Filter {LineURI -like $NumberInQuestionLike} | Select EXUMContact,SipAddress, DisplayName, LineURI, SamAccountName
Get-CsDialInConferencingAccessNumber -Filter {LineURI -like $NumberInQuestionLike} | Select DialInConf,SipAddress, DisplayName, LineURI, SamAccountName
Get-CsTrustedApplicationEndpoint -Filter {LineURI -like $NumberInQuestionLike} | Select TrustedApp,SipAddress, DisplayName, LineURI, SamAccountName
Get-CSMeetingRoom | ? {$_.LineURI -match $NumberInQuestion} | Select CSMeeting,SipAddress, DisplayName, LineURI, SamAccountName
}
Write-Host "OK, I finished. Have a nice day."
$endtime = get-date
$timeoutput = ($endtime - $starttime)
write-host "Time to run this script: $timeoutput"

1 thought on “Search Specific Lync Phone Number(s)”

Leave a Reply