Powershell Script : Enterprise Voice Details from UPN and LineURI.

 Hello All.

In this topic, we are going to see , how to get the Enterprise Voice Details from UPN and Lineuri from the bulk users. Let us see first how to get  it for single upn and Lineuri with the help pf powershell command and then will touch the powershell script part.

 we may come across the situation to fetch the  Enterprise voice details from list of given upn's or lineuri's  in real time scenario. 

for single user:

As many of us know the straight forward command is Get-Csonlineuser 



The real scenario  is , if you have bunch of user principal name (UPN) and business wants to you to find about the Enterprise voice details from bunch of UPN's

Another Scenario is . you have bunch of Lineuri and  business wants to you to find about  the Enterprise voice details from the list of lineuri's.  like UPN for the numbers,  AccountEnabled or not, EnyterpriseVoice Enabled or not, country, city, and some polices assigned.

Get the Enterprise Voice details from list of UPN's

Create a CSV file with list of upn's . Make sure your CSV is built as follows in one column with title name and all user principal Names 

Name
craft1@craftnet.in
craft2@craftnet.in
......
....

==========================================================================
Run the below script 

$UserList = import-csv "D:\Inputs\upnsample.csv"
Foreach ($User in $UserList) 
{
Get-CsOnlineUser -Identity $USer.Name | Select-object  DisplayName, userprincipalname, Enterp*, Lineuri, AccountEnabled | Export-Csv D:\Output\UPNEVnformation.csv -append
}
==========================================================================

Get the Enterprise Voice details from list of Lineuri's


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 .
Happy Leaning and Good luck.! 🙂



Comments