Forum Discussion

JFM_12's avatar
JFM_12
Iron Contributor
Jun 23, 2025
Solved

Powershell for creating a Auto Attendant

Hello

I would like to create an Auto Attendant through Powershell.
The command is New-CsAutoAttendant

Teams keeps asking about the DefaultCallFlow.

I would like to hardcode the command like this:


New-CsAutoAttendant -Name "xx" -LanguageId "fr-FR" -TimeZoneId "Romance Standard Time" 

 

How do I add the DefaultCallFlow and then redirect it to an external number

Regards
JFM_12

  • 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

4 Replies

  • 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,Thank you for bringing this issue to our attention. We will look into it and get back to you shortly. 

Resources