Forum Discussion

VikramPatil's avatar
VikramPatil
Copper Contributor
Jul 30, 2025

From Assignment to Empowerment: How I Deployed Teams Enterprise Voice Using PowerShell

During my last assignment, I successfully implemented Microsoft Teams Enterprise Voice (EV) for a large, diverse user base. With automation via PowerShell, I turned complexity into clarity—delivering seamless communication and routing. This blog shares that experience step by step, including production considerations for a robust rollout.

1.Prerequisites

Before you begin, make sure you’ve got:
•    Teams Phone System license assigned
•    Access to Teams PowerShell
•    Installed MicrosoftTeams PowerShell module
Install-Module -Name MicrosoftTeams
Import-Module MicrosoftTeams
Connect-MicrosoftTeams

2.Real-World Experience

Our deployment spanned users across globe with varied call routing requirements. Manual provisioning wasn't scalable, so scripting via PowerShell made it possible to:
•    Bulk-assign direct numbers
•    Create custom voice routes & PSTN usages
•    Grant user-specific policies based on department and role

3.Define PSTN Usages

Set-CsVoiceRoutingPolicy -Identity Global -PstnUsages "International", "National", "Local" New-CsPstnUsage -Identity "RemoteWorkersUsage"
You can customize -PstnUsages based on your organization’s dialing permissions. For example:
•    "Local" for regional calling
•    "National" for country-wide calls
•    "International" for global access

4.Create Voice Routes

New-CsVoiceRoute -Identity "IndiaRoute" -NumberPattern "^\+91\10}$"-PstnUsages "Local", "National"-OnlinePstnGatewayList "SBC1.domain.com"

5.Create Voice Routing Policy with PowerShell

Before assigning the policy to users via CSV, you need to create the routing policy first. Here’s how:
# Create all required policies beforehand
New-CsVoiceRoutingPolicy -Identity "IndiaPolicy" -PstnUsages "Local", "National", "International"
New-CsVoiceRoutingPolicy -Identity "RemotePolicy" -PstnUsages "RemoteWorkersUsage", "National"

6.Using CSV for Teams Enterprise Voice Provisioning

Prepare a CSV file like this:
csv
UserPrincipalName PhoneNumber VoiceRoutingPolicy

Save it as EVUsers.csv.

7.Pro Tips

  •    Validate your CSV for trailing spaces or formatting issues.
  •    Use logging to track changes with something like Out-File.
  •     Add error handling to catch provisioning failures gracefully.

8.Enable Users for Enterprise Voice & Assign Voice Routing Policies

#Import users and assign routing policies from CSV
$users = Import-Csv -Path "EVUsers.csv"
foreach ($user in $users) {# Assign phone number (excluded from Community version)  

Attaching snap as command is excluded from Community

Set-CsUser -Identity $user.UserPrincipalName -EnterpriseVoiceEnabled $true -HostedVoiceMail $true
Grant-CsVoiceRoutingPolicy -Identity $user.UserPrincipalName -PolicyName $user.VoiceRoutingPolicy }

9.Validate Your Setup

Get-CsOnlineUser | Select DisplayName, EnterpriseVoiceEnabled, HostedVoiceMail Get-CsVoiceRoutingPolicy -Identity "IndiaPolicy" Get-CsVoiceRoute

10.Key Production Considerations

  •    Back up configurations before running scripts
    •    Use pilot groups to verify routing behavior
    •    Test number patterns with actual samples
    •    Ensure SBCs are reachable and secure
    •    Communicate proactively with impacted users
    •    Enable audit logging for policy and route changes
    •    Schedule during change windows to avoid service disruption
    •    Collaborate with networking/security teams on QoS and port access

11.Conclusion

PowerShell enables rapid, accurate configuration and scalable EV environments. With thoughtful planning and testing, you can deliver a robust Teams Voice deployment like I did.

12.Final Words

Whether you're deploying for 10 users or 10,000, this guide—grounded in hands-on experience—can help you deliver a stable and scalable EV environment in Microsoft Teams.

No RepliesBe the first to reply

Resources