Forum Discussion
Lineuri to UPN - Help Urgent
- 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!
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!