Automate Auto Attendant Holiday Setup

Brass Contributor


It's that time of year again where I have to setup our phone system for the Holidays. We've now got a growing number of Auto Attendants (currently up to somewhere around 40), the majority of which I set the same holiday greeting and times on. Previously I've manually gone to each auto attendant added a new Holiday, which I then manually configure with a Holiday, greeting, and action.

With the number of Auto Attendants we've now got it's become somewhat of a repetitive pain to do, so I'm looking for ways to automate \ make it easier - I thought I could maybe use some sort of PowerShell Script to go through each one and set the settings holiday settings for me.

Has anyone else found a way to make this a little less of a pain.



5 Replies
Why not make one Holidays entry with all the holidays in it and just update it every year? You will never have to update the auto attendants.
I was looking for powershell cmdlet to import/set holiday greeting settings and found this (but not the cmdlet). My suggestion for making this easier based on your descirption: You can add the holidays for future years at once - almost all holidays fall on a predictable date so you can do them for years in advance. Then, make the holiday messages generic enough, e.g. "We are closed today for Memorial Day" or "We are closed Monday for Memorial day" instead of "We are closed May 31st for Memorial day" and you won't have to reset them for each holiday year after year,
best response confirmed by Therese_Solimeno (Moderator)

Yes, having not found any better way to do it I now set the Holidays in advance for the year, unfortunately I can't use a generic message, I have to include the date we will be open again, so I have to go through every Auto-attendant and amend the message on every holiday. Plus we have leisure facilities who work different hours to the rest of the university who like the message read out what hours they're open over the holidays - It would be nice to have some way of setting that message in one go all Auto Attendants that need it, but it's not too bad going through and changing them all individually.

Thanks for the responses.

I have seen many people looking for help with this issue (including myself) and finally being frustrated enough I have built a PowerShell script that will allow the management of a large number of Auto Attendants Holiday settings. At first, I  tried using the export/import-CSAutoAttendentHolidays commands but that action creates a new holiday instance for each AA and does not set the call flow, which means all calls just get disconnected with no message being read. Instead, I had to create a whole call flow based off  the documentation on


While I am not an expert in powershell, and am sure there are others who could improve this but as I have yet to see this information online I thought I would share what I have.



First: You will need to setup your list of Holidays in Teams Admin Center to reference. These can be updated each year to have the dates set for the upcoming year.


Second: You will need 2 CSV files. The first contains the list of Auto Attendants that you want to set the holidays for. This CSV will need a column labeled "AutoAttendantIdentity" which contains all the object ID's for the auto attendants. To find the object ID's you can use the Get-CsAutoAttendant commandlet. The second CSV will contain your list of holidays to be added. Must include columns: "MenuName" (Holiday Name) " CallFlowName" (Holiday Name) and "ScheduleID" (Object ID of Holidays.) To get the Object ID's of the Holidays you have created use the Get-CsOnlineScheudule to see a list of all operation hours in your environment, holidays will all be "FixedSchedules" and you can ignore the many "WeeklyRecurrentSchdules" in your tenant.


Third: In our organization I created an Auto Attendant named "Holiday Message" which is where all calls will be sent to during holiday hours. This allows for easy message management and will be referenced by all Holiday call flows the script will build.



#Paths to CSV File
$csvFile1 = "C:\temp\AutoAttendants.csv" # List of auto attendants to change. Must include column called "AutoAttendantIdentity" containing Object ID's for the Auto Attendants
$csvFile2 = "C:\temp\ScheduleIDs.csv" # List of Holidays to be added. Must include columns: "MenuName" (Holiday Name) " CallFlowName" (Holiday Name) "ScheduleID" (Object ID of Holidays)


#Import list of Auto Attendants
$autoAttendantIdentities = Import-Csv $csvFile1 | Select-Object -ExpandProperty AutoAttendantIdentity


#Loop through each Auto Attendant
foreach ($autoAttendantId in $autoAttendantIdentities) {
$autoAttendant = Get-CsAutoAttendant -Identity $autoAttendantId


#Send calls to "holiday Message" Auto Attendant
$callableEntityId = Find-CsOnlineApplicationInstance -SearchQuery "Holiday Message" -MaxResults 1 | Select-Object -Property Id
$callableEntity = New-CsAutoAttendantCallableEntity -Identity $callableEntityId.Id -Type ApplicationEndpoint


#Load List of Holidays and create call flow with unique naming for each holiday
Import-Csv $csvFile2 | ForEach-Object {


# Generate a unique name for each call flow
$uniqueId = get-random -Minimum 100 -Maximum 999
$uniqueName = $_.CallFlowName + - + $uniqueId


#Create call flow
$menuOption = New-CsAutoAttendantMenuOption -Action TransferCallToTarget -CallTarget $callableEntity -DtmfResponse Automatic
$menu = New-CsAutoAttendantMenu -Name $_.MenuName -MenuOptions $menuOption
$callFlow = New-CsAutoAttendantCallFlow -Name $uniqueName -Menu $menu
$callHandlingAssociation = New-CsAutoAttendantCallHandlingAssociation -Type Holiday -ScheduleId $_.ScheduleId -CallFlowId $callFlow.Id

$autoAttendant.CallFlows += $callFlow
$autoAttendant.CallHandlingAssociations += $callHandlingAssociation


#Apply Changes to Auto Attendant
Set-CsAutoAttendant -Instance $autoAttendant


- If the auto attendant is set to force listeners to hear all of the greeting before picking an option it will cause the script to fail at that point.

- If you do not have an auto attendant called "Holiday Message" the script will fail. 

- It will update you at each successful Auto Attendant completed.

- Each call flow had to have a unique name which is why the random number generator is used




@TYoung-OC Thanks for this, that is really useful.

The way I do it now I just amend the dates in a single Holiday which is applied to all of our Attendants so it's not too laborious. 

The only laborious part of it now is I'm still manually going through and editing the Holiday Greeting message on every AA manually - I had never considered just redirecting to a Holiday AA with a greeting message, to provide a single place to amend the message. I'm definitely going to do that in future that's going to make setting up holidays much easier.