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.

Monday, November 15, 2010

Cannot See Disconnected Mailbox Exchange 2007

If disabled or removed mailboxes don’t appear in the console.

Run the following cmdlet from EMS

Clean-Database -Identity SGName\DBName

Public Folder Item Count report

This can help compare public folder replicas on two different servers

Get-PublicFolder –server server1 -Recurse |Get-PublicFolderStatistics |ft Name, ItemCount, FolderPath > pfreport-sever1.txt