Forum Discussion
I want to change auto aftandend number using powershell
- Feb 03, 2025
Hi danikoershuis,
You detached the Variables, so nothing is written back to the $AA VariableConnect-MicrosoftTeams #Get AutoAttendand $AA = Get-CsAutoAttendant -NameFilter AutoAttendantDemo01 $AA.CallFlows | where {$_.Name -eq "AutoAttendantDemo01 After hours call flow"} $Menu = ($aa.CallFlows | where {$_.Name -eq "AutoAttendantDemo01 After hours call flow"}).Menu $Menu.MenuOptions #Create a new Target $CallTarget = New-CsAutoAttendantCallableEntity -Identity "tel:+1234567890" -Type ExternalPSTN $menuOption = New-CsAutoAttendantMenuOption -Action TransferCallToTarget -DtmfResponse Automatic -CallTarget $CallTarget #Figure out witch is the After hours call flow -> In my case it's the first Entry in the Array [0] $aa.CallFlows[0] $aa.CallFlows[0].Menu.MenuOptions #Set ne new Menu Option with the new Target to the $AA Object $aa.CallFlows[0].Menu.MenuOptions = $menuOption #Update the Autoattendant Set-CsAutoAttendant -Instance $AA
Kind Regards
Andres
Hi danikoershuis!
On PowerShell you can change the auto attendant settings by using the Teams PowerShell module. To modify the after-hours phone number, you’ll need to first connect to the Teams PowerShell module and then use the Set-CsAutoAttendant cmdlet. You can specify the after-hours settings and update the phone number with the AfterHoursCallRouting option. Make sure you have the correct permissions, and that you're working with a Teams admin account or have the required privileges for the task, otherwise you wont be able to do it. If you don't have access to the full Teams admin license, you might need to adjust permissions or roles in your tenant.
Hope it helps!