Thursday, October 24, 2013

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

Problem
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: http://technet.microsoft.com/en-us/library/bb397387%28EXCHG.80%29.aspx

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: http://edmckinzie.wordpress.com/2011/12/12/how-to-speed-up-a-large-exchange-2010-migration/
b. Turn on circular logging

 Step 3 - Move the mailboxes in bulk, using the advice here: http://www.msexchange.org/articles-tutorials/exchange-server-2010/management-administration/moving-mailboxes-exchange-2010-part1.html

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: http://technet.microsoft.com/en-us/library/bb397387%28EXCHG.80%29.aspx 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

Problem
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:   https://mbs2.microsoft.com/Knowledgebase/KBDisplay.aspx?scid=kb;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.


Code
 private static void RemoveProduct()
        {
            /*
             * Manual method for removing a third party product located here: https://mbs2.microsoft.com/Knowledgebase/KBDisplay.aspx?scid=kb;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))
                                {
                                    removedCounter++;
                                    continue;
                                }
                            }
                            sb.AppendLine(lines[i]);
                        }


                        //Now write the StringBuilder to the Dynamics.set file
                        using (StreamWriter writer = new StreamWriter(setPath, false))
                        {
                            writer.Write(sb.ToString());
                        }


                    }
                }
                //Now delete the dic file
                File.Delete(dicPath);
            }
        }

Monday, October 7, 2013

Lync sharing doesn't work internally for some users

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

Solution
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:
http://superuser.com/questions/321424/why-does-my-d-link-router-keeps-dropping-my-outlook-and-lync-connection

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