Forum Discussion
Powershell for creating a Auto Attendant
- Jun 24, 2025
Hello @JFM_12, To create a Teams Auto Attendant with New-CsAutoAttendant and redirect calls to an external number, you must define a DefaultCallFlow object that includes a call transfer action.
Here’s how you can do it in PowerShell:
# Define the external number (must be in E.164 format, e.g., +33123456789 for France) $externalNumber = "+33XXXXXXXXX" # Create the call transfer action $transferTarget = New-CsAutoAttendantCallableEntity -Identity $externalNumber -Type ExternalPstn $callTransferAction = New-CsAutoAttendantCallTransferAction -TransferTarget $transferTarget # Create the call flow with the transfer action $defaultCallFlow = New-CsAutoAttendantCallFlow -Name "Default" -Greetings @() -Menu $null -Actions $callTransferAction # Create the Auto Attendant New-CsAutoAttendant -Name "xx" ` -LanguageId "fr-FR" ` -TimeZoneId "Romance Standard Time" ` -DefaultCallFlow $defaultCallFlow
Reference Document-
1. New-CsAutoAttendant (MicrosoftTeamsPowerShell) | Microsoft Learn
2.New-CsAutoAttendantCallFlow (MicrosoftTeamsPowerShell) | Microsoft Learn
Hello @JFM_12, To create a Teams Auto Attendant with New-CsAutoAttendant and redirect calls to an external number, you must define a DefaultCallFlow object that includes a call transfer action.
Here’s how you can do it in PowerShell:
# Define the external number (must be in E.164 format, e.g., +33123456789 for France)
$externalNumber = "+33XXXXXXXXX"
# Create the call transfer action
$transferTarget = New-CsAutoAttendantCallableEntity -Identity $externalNumber -Type ExternalPstn
$callTransferAction = New-CsAutoAttendantCallTransferAction -TransferTarget $transferTarget
# Create the call flow with the transfer action
$defaultCallFlow = New-CsAutoAttendantCallFlow -Name "Default" -Greetings @() -Menu $null -Actions $callTransferAction
# Create the Auto Attendant
New-CsAutoAttendant -Name "xx" `
-LanguageId "fr-FR" `
-TimeZoneId "Romance Standard Time" `
-DefaultCallFlow $defaultCallFlow
Reference Document-
1. New-CsAutoAttendant (MicrosoftTeamsPowerShell) | Microsoft Learn
2.New-CsAutoAttendantCallFlow (MicrosoftTeamsPowerShell) | Microsoft Learn
Hi Sayali-MSFT
Great thank you.
It worked
Regards
Juan
- Sayali-MSFTJun 25, 2025
Microsoft
Hello JFM_12,
Glad to hear that your issue is resolved
We would appreciate it if you could share your valuable feedback via the Microsoft Teams Developer Community Response Feedback link?