Wednesday, November 24, 2010

Adding or Deleting Company Holidays to/from All Users’ Calendars–Exchange 2007

I was recently asked to figure out a silent method of adding our organization’s holiday’s to all users calendars. Following was my approach.
First I thought of looking for a client side solution. Everyone in our organization uses Outlook 2007 and outlook uses a file name outlook.hol for holiday configuration. Following is the format of file, it can be created using a simple text editor and can be distributed by an email or commandline (outlook.exe /hol holidayfilename)
[Country or Description] ###
Event or holiday description, yyyy/mm/dd
Event or holiday description, yyyy/mm/dd
read for more details
Above is not very clean for a large environment, so I was not too happy with this solution and started taking a different approach.
Definitely it would be so much easier doing it with Exchange Management Shell and finally I found my answer.
Here is what's needed for a great solution
  • Exchange Management Tools and Outlook 2007 installed on a 32bit machine
  • Outlook 2007 to create a PST file
  • Export-mailbox
  • Import-mailbox
  1. First of all create all events for all holidays in a mailbox Calendar and export it to a PST file or Create a Calendar Item in a PST file with the name “Calendar” and create all events in it.
  2. On 32bit a machine where outlook 2007 is installed login with an Exchange Enterprise Admin account and open Exchange Management Shell then run the following

    $users=Get-Mailbox –ResultSize Unlimited
    Import-Mailbox $users –PSTFolderPath c:\pstfolder/pstfile.pst –IncludeFolders ‘\Calendar’
  3. Above will add all items from the PST File Calendar to all users’ calendars.
Now what happens if someone comes to you and says hey there is an event we need to delete from all users’ calendars, simple!!
Get-Mailbox –ResultSize Unlimited | Export-Mailbox –IncludeFolders ‘\Calendar’ –SubjectKeywords “Subject of the appointment” –DeleteContent
Hope this is useful!! Please comment.


  1. How would you modify the command to use with a particular user instead of all users ($users).

  2. Dear Michael,
    u can simply do

    import-mailbox username –PSTFolderPath c:\pstfolder/pstfile.pst –IncludeFolders ‘\Calendar’


    Get-Mailbox username | Export-Mailbox –IncludeFolders ‘\Calendar’ –SubjectKeywords “Subject of the appointment” –DeleteContent

  3. I hate that I didn't think of this myself!! Awesome find! and Thank you for sharing!

  4. Great solution, but what about new users, they still need this import after creation, isn't there a solution, for existing and new users automatically?

    1. Scheduled tasks with Exchange Management Shell will do the trick. if you don't want to repeat on already updated users, then you can update one of the custom attribute with a string so accounts with that string can be ignored.

  5. This comment has been removed by the author.

  6. Good post, need the same way for a Exchange 2010 system...

  7. Nice one
    Does it work with Exchange 2010 ?
    Do you know how we remove all the old entrys imported through .HOL files ?


Leave a comment if you find this post useful or if you have any questions