Forum Discussion

ramki1465's avatar
ramki1465
Brass Contributor
Apr 27, 2023

Lineuri to UPN - Help Urgent

Hello Team   Looking for some urgent to help i have list of around 1000+ LINEURI numbers  and i using the below small script to get the output of who is using these numbers from Teams powehell.  ...
  • KilianTyncke's avatar
    Apr 28, 2023

    Hello Ramki

    You could do a Write-Host $USer.num to see what numbers you are trying to match on the -eq query. There is probably something going wrong there. It looks like your format might be off or it might be recognized as an object instead of a number.

    You can do what you are trying to achieve as follows:

    Make sure your CSV is built as follows in one column with title NUMBER and all numbers underneath in format tel:[E164], for example tel:+3212345678.

    Like so:

    NUMBER
    tel:[E164]
    tel:[E164]
    ...

    Then run this script:
    $numberList = Import-Csv [FILEPATH]
    Foreach ($num in $numberList) {
    Get-CsOnlineUser | Where-Object {$_.LineURI -eq $num.NUMBER} | Select-Object UserPrincipalName, LineURI, EnterpriseVoiceEnabled, AccountEnabled}

    It will take a while but it'll do the trick.

    Kind regards!


Share

Resources