Thursday, October 24, 2013

Exchange backup failing due to ESE 474, how to move mailboxes

I am using Windows Server Backup to backup my Exchange Server database and noticed that the backup job has an error saying "the application will not be available for recovery. The consistency check failed for component Microsoft Exchange Server...", and I also noticed that transaction logs were not getting flushed.

Troubleshooting and Solution
Looking in the Event Viewer I found event 474, ESE, which states that a page level verification failed due to a page checksum mismatch. Googling lead me to this:

First, I ran eseutil /K against the mailbox database. This showed me that there were indeed consistency check failures.

Following the advice in the article I chose to try moving mailboxes to a new database, being sure to choose the option to not move mailboxes if they had errors. If they had errors I would then run eseutil /P against the mailbox database that had corrupt mailboxes in it.

Step 1 - Create a new mailbox database. This can be done in the Exchange Management Console is straightforward.

Step 2 Prep the server to speed up the mailbox migration process
a. using the advice here:
b. Turn on circular logging

 Step 3 - Move the mailboxes in bulk, using the advice here:

Step 4  -   Check to see if any mailboxes failed to move.

a. If they did, run eseutil /K on the old database, then eseutil /P.
b. After repairing try to move the mailboxes that failed

Step 5 - Dismount the new DB and run eseutil /K on it
If there's problems it probably means there's a hardware failure. Please read more on here about the ESE 474 problem: They say sometimes it's a hardware failure and sometimes it's a logical file problem.

Step 6 (if no problems in step 5) - Disable circular logging. Then remount the DB.

Step 7 - Run a full backup on the new DB and check for problems.

Tuesday, October 22, 2013

C# code for removing a third party product from Dynamics GP

We have a Dynamics GP third party product that  has been decommissioned and needs to be removed. The manual process of removing a third party product is explained here:;en-us;872087

However, I didn't want to place the burden on the customer/partner for removing it so I created a C# method that does this automatically.

Note: This code is called in a Console Application that's run by my installers. It's called in try catch block and errors are logged. This means errors are suppressed, but logged.

 private static void RemoveProduct()
             * Manual method for removing a third party product located here:;en-us;872087
             * Check if the dic exists in the directory.
             *  If it does then
             *  1. Remove references to it from the Dynamics.set file
             *  2. Remove the file
            string dic = "Product9999.DIC";
            string fFile = "F9999.DIC";
            string rFile = "R9999.DIC";
            string prodName = "My Product Name";
            string prodNum = "9999";

            string setPath = Path.Combine(Environment.CurrentDirectory, "Dynamics.set");
            string dicPath = Path.Combine(Environment.CurrentDirectory, dic);

            //Only execute if the dic is present
            if (File.Exists(dicPath))

                //Only execute if the Dynamics.set file exists
                if (File.Exists(setPath))
                    //use a string instead of the StringBuilder below, because otherwise we'd be removing from a StringBuilder and that's inefficient
                    string setFileString = "";
                    using (StreamReader reader = new StreamReader(setPath))
                        setFileString = reader.ReadToEnd();
                    if (!string.IsNullOrEmpty(setFileString))
                        StringBuilder sb = new StringBuilder(setFileString.Length);
                        string[] lines = setFileString.Split(new string[] { Environment.NewLine }, StringSplitOptions.RemoveEmptyEntries);

                        //Decrement the first line by 1
                        sb = sb.AppendLine((int.Parse(lines[0]) - 1).ToString());

                        int removedCounter = 0;
                        for (int i = 1; i < lines.Length; i++)
                            //Once the 5 lines that specify a product have been removed we know we can stop looking,
                            //so append the rest of the lines

                            if (removedCounter < 5)
                                //If the line contains what we want removed, don't append to the StringBuilder
                                if (lines[i] == prodNum || lines[i] == prodName || lines[i].Contains(dic) || lines[i].Contains(fFile) || lines[i].Contains(rFile))

                        //Now write the StringBuilder to the Dynamics.set file
                        using (StreamWriter writer = new StreamWriter(setPath, false))

                //Now delete the dic file

Monday, October 7, 2013

Lync sharing doesn't work internally for some users

*Most* users have no problem with sharing their screen in lync, but for others it fails repeatedly.

This is most likely a problem the user's router settings. We have several remote workers, and so i am not in control of their routers (since it's in their house, not an office). The best thing to do is get the model of the router and search "RouterName lync traffic", for example,
in my particular case the user has a dlink router, and i found this:

I had them change that setting in their router and voila, it worked!
There was an error in this gadget