Teams PowerShell Reference Commands
Had to provide a customer with Teams PowerShell reference commands, so though why not post it here for later use. These make up some of the most common commands in User setup and management.
#Install Teams Modules in PowerShell (Only needs to be done once)
Install-Module -Name MicrosoftTeams
# Connect in PowerShell (Need to do each time you run powershell)
Connect-MicrosoftTeams
# This will then prompt for admin credentials to connect
# Enable User and Assign Phone Number / Voicemail
Set-CsUser -Identity "[email protected]" -LineURI tel:61234567890 -EnterpriseVoiceEnabled $true -HostedVoiceMail $true
# Set Routing Policy
Grant-CsOnlineVoiceRoutingPolicy -Identity "[email protected]" -PolicyName "AU-CentralEast-International"
# Set Dial Plan
Grant-CsTenantDialPlan -Identity "[email protected]" -PolicyName "AU-NSW"
# Get a list of enabled Users
Get-CSOnlineUser | Where { $_.EnterpriseVoiceEnabled } | Select-Object UserPrincipalName,DisplayName,LineURI
# Export a list of enabled Users and export to UserData.csv (For filtering in Excel for free numbers etc)
Get-CSOnlineUser | Where { $_.EnterpriseVoiceEnabled } | Select-Object UserPrincipalName,DisplayName,LineURI | Export-Csv -Path UserData.csv