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:...
  • Sayali-MSFT's avatar
    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

Resources