The Microsoft Teams admin center is a fine way to manage your enterprise voice deployment. You can assign phone numbers, set emergency locations, or view unassigned numbers. However, there is not an easy way to verify everyone’s Teams emergency addresses. Enter PowerShell!

In this post, you will learn how to use PowerShell to find Teams voice users’ current emergency address and export this information using PowerShell.

Connect to Skype for Business Online PowerShell

First, you need to connect a remote session to Skype for Business Online PowerShell. If you are unsure how to do this, Microsoft Docs has a great article on how to do so:

Microsoft Docs: Manage Skype for Business Online with PowerShell

If you run into problems, check out my article Errors Connecting to Skype for Business Online PowerShell Module.

Note that Microsoft is retiring the Skype for Business Online Windows PowerShell module in February 2021. It will no longer be available for download, and Skype for Business Online will stop accepting connections from it later this year.

Getting Voice Users

Now that you are connected to PowerShell, you use the Get-CsOnlineVoiceUsers cmdlet to find voice-enabled users. If you don’t specify an identity, it will return all users. In my demo tenant, I have one voice user.

Viewing a voice user's information

Up until recently, the Name property was not displayed in the results. It seems Microsoft has made a change, so the Name field is now displayed. The absence of the Name property made it difficult to know which voice user you were viewing. You had to take the Id property and use it in the Get-CsOnlineUser cmdlet to find the user information. If your tenant does not display the name field, you can use the -GetFromAAD parameter, like so:

Get-CsOnlineVoiceUser -GetFromAAD

Getting Location Information

You’ll notice in the screenshot above that the location information is blank. If you’re creating an inventory of voice users, you probably want to export the user’s Teams emergency address. Having a correct emergency location is key to ensuring users quickly reach emergency services. If you want to include the location information, add the -ExpandLocation parameter to return the location information.

Get-CsOnlineVoiceUser -ExpandLocation
Viewing voice user's information with location details

The command now returns location information but in a format that is not very helpful. All the information is stored in this location object.

Expanding Location Information

One option is to save the results of the command to a variable to expand the location information. For example, here I’m saving a single user’s information to a variable:

$voiceUser = Get-CsOnlineVoiceUser -Identity {UPN} -ExpandLocation

Now with the voice information saved to a variable, I can access all of the emergency address information saved in the location object.

$voiceUser.Location
Viewing location properties

Breaking Down Emergency Addresses

Teams emergency addresses are divided into two parts: civic addresses and places. Every emergency address has a civic address. The civic address is the address of the emergency location. In the screenshot above, this would be 300 Park Avenue, Oklahoma City, OK.

Civic addresses can be further broken into places or locations. Maybe the location at the civic address has multiple buildings or is a multi-story building. Within the civic address, you can define places within the location. In the screenshot above, the place is Suite 700. Instead of creating multiple civic addresses for a multi-floor building, you can instead define places within the location.

The CivicAddressId denotes the unique identifier for the civic address, and the LocationId denotes the more specific place of Suite 700 within the associated civic address. Not every user will have a Location as their emergency address may only be the physical address.

Putting It All Together

Now that we know how to find the user’s emergency location, here is a script to find all voice users and output a report showing the name, phone number, and emergency location information. You can include as many emergency location properties as you need.

Viewing script output
Script output with voice and emergency address information

Closing

By adding a parameter to a PowerShell command, you can extract more information about your Teams voice users. You can then take this information and generate a nice report on voice users.

Questions or comments? If so, leave a comment below or find me on Twitter or LinkedIn to discuss further.

Leave a Reply