Adding Events to Multiple Mailboxes using Exmerge


Introduction


Let’s say someone at the corporate level asks you to add some company events to all the employee calendars. So, you consider your options in an internal meeting. The most obvious option is to send a meeting request to everyone. Once you learn that there are actually quite a few events and also realize that not everyone accepts these meetings (as a convenient way of not going to some of the more tedious events).


So, you consider other options. Outlook has two formats of holidays lists you can import. Outlook.txt is used by Outlook 97, 98 and 2000 and Outlook.hol is used with Outlook XP/2003 and Outlook 2003. You can customize them but users must import them manually, you can import them by creating a profile for each user on a single computer and do this yourself. This can be quite tedious work so you might decide to script the whole thing or even use a pre-prepared code such as this one:


http://www.outlookcode.com/d/forms/holiday.htm


Testing shows that while this code works great on Outlook 2000 with no SP3 installed and below, newer versions will block macros, or ask users to allow these macros to work. You can sign the macros, but you still have to distribute them through the login script which is fine if you’re not considering people who rarely login to your internal network such as external employees and some of the sales force. Some of them will be quite insulted when they’re not invited to some of the events.


Is all this giving you a headache yet? Well, I propose a different method, that uses the Exchange ExMerge tool to distribute these events.


Installing ExMerge


The Exchange Server Mailbox Merge Wizard was originally a “last resort” tool used to extract information from servers with damaged databases and as a way to migrate mailboxes to a new organization.


Exmerge basically copies all the information from a source server into a .PST file which then can be merged into the destination server. But it can also be used to merge new data which is useful in our case.


To download Exmerge 2003 go here:


http://www.microsoft.com/downloads/details.aspx?FamilyID=429163ec-dcdf-47dc-96da-1c12d67327d5&displaylang=en


When installing it on a workstation, make sure the Exchange 2003 System Manager is installed.


After installation, add “c:\program files\exchsrvr\bin” to your path so that Exmerge can locate some required Exchange DLLs. This is done using the Control Panel -> System Applet.







Exmerge requires permissions to all the mailboxes in order to be able to import and export information. This permission is denied by default in Exchange 2000/2003 to the administrative accounts.


To overcome this you need to use the ADSIEdit tool. To use it, first install the Windows 2000/2003 Support Tools. Then locate the Exchange Organization object as shown below.




The property page of this object would show the Administrator account, and the Domain Admins and Enterprise Admins to have “Deny” permissions on the “Receive As” and “Send As” properties. Once you uncheck those you would be able to access all mailboxes using the Administrator account.







Alternatively you can create a user, add the user to the “Exchange Enterprise Server group” and the “Server Operators” group.


Creating the Events PST File


Next thing would be to create a template user for the holidays. I’ve used the Administrator mailbox for this purpose since its calendar was empty.


Now add a few events:





Once this is finished I export everything to a PST file by selecting File -> Import and Export from the main Outlook menu.








Duplicating the PST File


Exmerge exports and imports PST files by using the Alias field which typically would match the usernames. The alias field is known in Active Directory as “mailNickname”.


So in order to use Exmerge to import events into multiple calendars we need to use a script making multiple copies of a single PST file like the one just created. Each copy will match the alias of a mailbox.


Following is such a script in VBScript format. To use it simply copy and paste into notepad and save it with a VBS extension. 



Dim rootDSE, domainObject
‘Find the domain container for your domain
Set rootDSE=GetObject(
LDAP://RootDSE)
DomainContainer = rootDSE.Get(“defaultNamingContext”)


Set fs = CreateObject (“Scripting.FileSystemObject”)


‘Now we want to open a channel to Active Directory:


Set conn = CreateObject(“ADODB.Connection”)
conn.Provider = “ADSDSOObject”
conn.Open “ADs Provider”


‘After opening a channel we construct the LDAP query.  It looks for all the


ldapStr = “<LDAP://” & DomainContainer & “>;(& (mailnickname=*) (| (&(objectCategory=person)(objectClass=user)(!(homeMDB=*))(!(msExchHomeServerName=*)))(&(objectCategory=person)(objectClass=user)(|(homeMDB=*)(msExchHomeServerName=*))) ));adspath;subtree”


‘Then we actually execute the LDAP query.


Set rs = conn.Execute(ldapStr)


‘So, now we’ve got an array of users (rs) that we can use.


While Not rs.EOF


     Set oUser = GetObject (rs.Fields(0).Value)
‘Disregard the System Mailbox used internally by Exchange


        if Left (OUser.MailNickname,13) <> “SystemMailbox” Then


‘Make a copy of the original PST with using the alias of the user


        fs.CopyFile “c:\PST\administrator.pst”,”C:\PST\” & OUser.mailNickname & “.pst”
     End If
     rs.MoveNext
Wend


The script assumes that the template user is Adminstrator and the PST files are in the C:\PST folder, but you can change the line that says:



fs.CopyFile “c:\PST\administrator.pst”,”C:\PST\” & OUser.mailNickname & “.pst”


to whatever you want. Other than that the script will work in any domain and organization so there’s no need to change that.


Importing Using Exmerge


Now we are ready to run the Exmerge Wizard.











Once the import process is finished, opening a user’s mailbox shows the appointments.




Deleting Appointments


So setting up the events is taken care of, but what if you need to reschedule or delete an event?


The advanced options of Exmerge allow you to delete any item based on criteria so you can use the “Extract” process to do this. This process exports the information you select to PST files you can simply delete.







Here I selected the “Apocalypse” meeting to be deleted.





And indeed once the process is over the meeting is deleted from all the mailboxes.




Conclusion


While this process might seem complex, once it is understood it can be used for various purposes and can be quite flexible.


More importantly, it is done on the server side and works for every kind of client, which is becoming more important every day due to the increase in mobile connectivity to Exchange.

Leave a Comment

Your email address will not be published.

This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

Scroll to Top