Category: Databases

You run the Exchange 2007 BPA and you get a warning for Disable MAPI Clients.

Disable MAPI Warning

Disable MAPI Warning

This warning is not a huge deal, as it has been present on my production Exchange server for months without causing issue. I HATE error messages though, and I am now getting around to getting rid of it.

You could go read the lengthy Technet article (linked here) or you could skip all the explanation and just fix it. Read on…

What this setting does is tells Exchange with versions of Outlook can connect to it. I have the pleasure of installing all of the office clients, so I know the lowest version of Outlook is 2007. I also know no one in the office connects to Exchange from Outlook at home (VPN or RPC over HTTPS) that is lower than 2007. So why would I let outdated clients such as 97, 98, 2000 or 2003 connect? I wouldn’t!

A list of client version numbers is here.

Warning: If you have older clients that connect using Outlook 2003 or 2k, you might not want to follow my advice.

Let’s see what sort of clients connect right now. Open up Exchange Management Shell. It will be in the Start Menu, under All Programs Exchange Server 2007.

Once it’s open, you need to navigate to the folder that has the scripts in it. Type in: cd “C:\Program Files\Microsoft\Exchange Server\Scripts” and hit enter (leave the quotation marks on). Now type get-logonstatistics



You get a long page, so lets put it in a text file to decipher by adding > c:\logon.txt. Reading the file tells us nothing, at least me anyhow. I blocked out the names to save identities.

So, I’ll look another way. Ill navigate to HKEY_LOCAL_MACHINE\System\CurrentControlSet\Services\MSExchangeIS\ParametersSystem registry value in regedit and read the value for DisableMAPIClients.

Mine is set to 0.0.0-5.3164.0, which is the default. I would like to restrict everything before Outlook 2007. So, reading the Technet article leads me to this value:


Warning: Back up all changes to the registry before you make them. Save the file with the date on it. If you break your box, it’s not my fault- registry changes can be dangerous.

I notice though that my Exchange does not want me to block version 8.x.x. So I will change that value to the lowest in the 9x.x range there is, which gives me:


This is telling Exchange to block ALL MAPI Access from client up to Outlook 2007, including Outlook 2003 SP3, excludeing ESA and Outlook 2007, 2010. This excludes a few numbers between 5.x.x and 9.x.x. This is because the Exchange System Attendant components use these numbers, so do not restrict them. Ill paste that value in the registry key.



Close out regedit and see now what BPA warns you about:
 The message now reads:

Some versions of MAPI clients are blocked on server SOLACESERVER.solace.local. Verify that version ‘6.x.x.x’ and version ‘8.x.x.x’ clients are not blocked as the Microsoft Exchange System Attendant process uses these version identifiers for performing server functions. Current MAPI blocking setting: 0.0.0-5.65535.65535;9.0.2711-11.65535.65535.

Thats correct then, as our warned numbers are excluded. Safely hide this message from all instances. If you have client connection problems, you can change this value in the future.

Running the Exchange 2007 BPA today brought back a few errors, let’s go about setting them right. the first is Max Database Cache Size.

Exchange BPA Warning

Exchange BPA Warning

As you can see there are other errors, for other posts. So, if you click the Tell me more about this link, it takes you to the MS Technet post here. They ramble on and on describing the problem and defaults, etc. Forget that, let’s just fix it (though I of course read it all).

MS Technet says “To better allow for cache growth, we recommend that the DatabaseMaxCacheSize value be increased from 128 MB to 512 MB on transport servers that have 4 GB or more of RAM.”

Well, I have 8 GB of RAM, and though I do not experience heavy message loads, I feel like the cache size should be higher than a low 128Mb (134 really).

MS Technet then says “To improve performance by using version buckets and to allow for increased database cache growth, increase the DatabaseMaxCacheSize value from 128 MB to 512 MB on Hub Transport or Edge Transport servers that have 4 GB or more of RAM.”

We will start by editing an Exchange config file with a value for DatabaseMaxCacheSize.

Start>Run and enter %ProgramFiles%\Microsoft\Exchange Server\Bin

Find the file EdgeTransport.exe.config and right click it, selecting edit (Use Notepad). If Edit is not an option, click Open With and select Notepad.

NOTE: I like to backup all system files before I edit them. I have a spceial folder that I keep edited files in case I need them. In this case, I copy EdgeTransport.exe.config and place it in my backup folder (removable HDD) and add .old to it.

On the page displayed, about half way down is a line:     <add key=”DatabaseMaxCacheSize” value=”134217728″ />

This is our value. Replace the 134217728 with 536870912.

Exit the EdgeTransport.exe.config and make sure you save it on the way out.

MS Technet then tells us to stop the Exchange Transport service and restart it by using a command prompt and net stop msexchangetransport && net start msexchangetransport

I would rather do the GUI, so I click Start>Run and type in Services.msc

Right click Microsoft Exchange Transport and click Restart.

Restart Transport

Restart Transport

Thats it. Rerun the BPA and the warning is gone.

If you notice stability issues with Exchange, revert this setting back to the old setting by editing, or restore the .old file.

I use this simple script to backup some items on my server, which I would like separated out of the standard Windows SBS 2008 Backup and WSUS 3. It is possible to do a lot with the default server backup, but what if you need just one file? Welol, it’s a pain in the butt to get that out of a full server backup. You could use NTBackup to backup the whole server, but restoring that can be difficult, as SBS 2008 doesn’t recognize NTBackup’s. You could do it with the WBADMIN command, but a lot of people don’t know how to use it. So here is the script. I will post the code, then describe what each part does. Feel free to customize it, or post improvements on it. Im also going to remove all of the echo commands that I have that let me know what each stage is doing. To add a text feedback to this script that will inform you of what’s going on, do the following:

Type Echo
I use ***TEXT*** so that it is visually explicit.

@SET STSADM="c:\program files\common files\microsoft shared\web server extensions\12\bin\stsadm.exe"
for /F "tokens=1-4 delims=/- " %%A in ('date/T') do set DATE=%%B%%C%%D
for /F "tokens=1-4 delims=:., " %%a in ('time/T') do set TIME=%%a%%b%%c


%STSADM% -o backup -url "http://companyweb" -filename "\\solaceserver\300GB HP Backup\Companyweb Backup\Companyweb_Backup_%DATE%_%TIME%.dat" -backupmethod differential -item "farm" > "\\solaceserver\300GB HP Backup\Companyweb_Backup_log.txt"

xcopy /y "C:\windows\system32\inetsrv\config" "A:\IIS Backup\" /e > "A:\IIS_Backup_log.txt"
xcopy /y "D:\EZ Claim Data" "A:\EZ Backup\" /e > "A:\EZ_Backup_log.txt"
xcopy /y "C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\12" "A:\CompanywebStyle\" /e > "A:\Companyweb_Style_Backup_log.txt"

sqlcmd -S .\SBSMONITORING -i "C:\SQL Scripts\sbsmonitoringbackup.sql"
sqlcmd -S \\.\pipe\MSSQL$MICROSOFT##SSEE\sql\query -i "C:\SQL Scripts\admincontentbackup.sql"
sqlcmd -S \\.\pipe\MSSQL$MICROSOFT##SSEE\sql\query -i "C:\SQL Scripts\sharewebdbbackup.sql"
sqlcmd -S \\.\pipe\MSSQL$MICROSOFT##SSEE\sql\query -i "C:\SQL Scripts\spconfigbackup.sql"
sqlcmd -S \\.\pipe\MSSQL$MICROSOFT##SSEE\sql\query -i "C:\SQL Scripts\susdbbackup.sql"
sqlcmd -S \\.\pipe\MSSQL$MICROSOFT##SSEE\sql\query -i "C:\SQL Scripts\wsscontent_c76dcbackup.sql"
sqlcmd -S \\.\pipe\MSSQL$MICROSOFT##SSEE\sql\query -i "C:\SQL Scripts\wsscontent_cb60cbackup.sql"
sqlcmd -S \\.\pipe\MSSQL$MICROSOFT##SSEE\sql\query -i "C:\SQL Scripts\wsscontentbackup.sql"
sqlcmd -S \\.\pipe\MSSQL$MICROSOFT##SSEE\sql\query -i "C:\SQL Scripts\wsssearchbackup.sql"

IF EXIST A:\GPO_Backup RMDIR A:\GPO_Backup /s /q

FOR /f "tokens=1-3 delims=/ " %%a in ('DATE/T') do set date=%%b-%%a-%%c
FOR /F "tokens=1-5 delims=/: " %%j IN ('TIME/T') do set time=%%j-%%k

cscript BackupAllGPOs.wsf A:\GPO_Backup /Comment:"GPO backup on %DATE%_%TIME%" /Domain:solace.local

for /F "tokens=1-4 delims=/- " %%A in ('date/T') do set DATE=%%B%%C%%D
for /F "tokens=1-4 delims=:., " %%a in ('time/T') do set TIME=%%a%%b%%c

ntbackup backup "@A:\Exchange File Backup\Exchange_NTBackup_Config.bks" /a /d "Exchange Server" /v:no /r:no /rs:no /hc:off /m normal /j "Exchange Server" /l:s /f "A:\Exchange File Backup\Exchange_Backup_%DATE%_%TIME%.bkf" > "A:\Exchange_Backup_Log.txt"

Code Description
@ECHO OFF This gags the code from being repeated visually on the script
@SET STSADM=”c:\program files\common files\microsoft shared\web server extensions\12\bin\stsadm.exe” This sets the directory for STSADM. This might vary by computer depending upon your install, but the directory you see is the default.
for /F “tokens=1-4 delims=/- ” %%A in (‘date/T’) do set DATE=%%B%%C%%D for /F “tokens=1-4 delims=:., ” %%a in (‘time/T’) do set TIME=%%a%%b%%c This code and the following FOR code sets variables that allow us to put the date into a filename.
CHOICE /C:YN /D:N /T:3 This is a choice command, with a timer, /T:3 is 3 seconds. This doesn’t really do anything but pause- I add the text to it something like Press Ctrl-C to cancel backup now! Ctrl-C breaks the script.
%STSADM% -o backup -url “http://companyweb&#8221; -filename “\\solaceserver\300GB HP Backup\Companyweb Backup\Companyweb_Backup_%DATE%_%TIME%.dat” -backupmethod differential -item “farm” > “\\solaceserver\300GB HP Backup\Companyweb_Backup_log.txt” This runs the STSADM command. It is the command line version of Sharepoint Administration, and command backup without using the GUI in Central Administration. –o backup tells it to backup “http://companyweb”. –Filename tells us the location of the backup.dat. the > xxx.log.txt tells the script to output all the results of that command into a logfile. I have each command in a separate logfile to ease confusion.
xcopy /y “C:\windows\system32\inetsrv\config” “A:\IIS Backup\” /e > “A:\IIS_Backup_log.txt” Xcopy is simply a copy command. I run this on several critical directories, and make a hard backup of the files contained. /y makes the script overwrite, while the following “ are the backup target and backup end directory. /e copies subdirectories and folders.
sqlcmd -S .\SBSMONITORING -i “C:\SQL Scripts\sbsmonitoringbackup.sql” sqlcmd -S \\.\pipe\MSSQL$MICROSOFT##SSEE\sql\query -i “C:\SQL Scripts\admincontentbackup.sql” I run 10 of these. SQL 2005 Express does not offer native backup scheduling. But you can enter an instance, and manually set up a backup. Then you can script this to file, then you run the file from this script. How to do this is documented here.
IF EXIST A:\GPO_Backup RMDIR A:\GPO_Backup /s /q IF NOT EXIST A:\GPO_Backup MD A:\GPO_Backup This command checks for a directory. If it exists it deletes it and creates it again, empty. This keeps down the size of a directory.
cd “C:\GPMC\SCRIPTS” cscript BackupAllGPOs.wsf A:\GPO_Backup /Comment:”GPO backup on %DATE%_%TIME%” /Domain:solace.local This backups all Group Policy Objects. Download the script files from here. Change this command to match the location you install the .wsf files. Quite handy.
ntbackup backup “@A:\Exchange File Backup\Exchange_NTBackup_Config.bks” /a /d “Exchange Server” /v:no /r:no /rs:no /hc:off /m normal /j “Exchange Server” /l:s /f “A:\Exchange File Backup\Exchange_Backup_%DATE%_%TIME%.bkf” > “A:\Exchange_Backup_Log.txt” This performs an Exchange only backup. You need to create the backup with NTBackup, and save selection as. Then you reference the bks file in this script. The command descriptions are here.
Exchange Management Console Database Recovery

Exchange Management Console Database Recovery

I now extracted a new copy of the mailbox database from the backup, using NTBackup again. I restored it to my desktop, not the original location. I opened MS Exchange 2007 MC, and clicked on Toolbox in the navigation pane. Then I clicked on Database Recovery Management. I left everything default and hit next, next.

  1. I clicked Create a Recovery Storage Group.
  2. I left everything as default, default name, and linked it to the First Storage Group, which now contains my current mailboxes.
  3. After the wizard completed, I navigated to the location of the storage group folder, which is inside my First Storage Group folder.
  4. I copy all of the files from the restored Exchange database folder- about 3 Gb in 25 files.
  5. I then try to mount the database from inside the Database Wizard- which comes back with some MapiCallError. Gah!
  6. So I run Repair Database. It gives me a warning- but at this point, who cares.
  7. I let it run, and it completes. And the database mounts successfully!

Now how do I get the mail back? I run the Merge or Copy wizard, which I zip through not really knowing what is going on- and after completion, it restored no mailboxes, the GUID did not match. So I take some more time, and click advanced options. I match and sort by Mailbox Name and try to merge again- still an error with the matching. So I go back into advanced options, and I Restore them to my admin mailbox. I create a folder called Restore, and select all the mailboxes to restore. This runs for a while, and I am seeing items appear.

And then they stop appearing, and my email slows to a crawl. Ugh, Exchange. I delete all of the exported items, half of which did not show up anyhow. So I decided to try a slower approach. I export ONE users mailbox into my mailbox at a time, and it worked. I then exported each of the items from that restored mailbox out of Outlook to a shared folder. I go to a workstation, and log in as that user, and then import their old mail items back into their Exchange mailboxes. It works, thank God. There is a way to do it from the server using EMS, but this requires Exchange Tools 32bit, which you can’t install on a 64bit server. So since I would need to go to another PC anyways, I might as well just restore them from PST files. A whole lot of this episode could have been avoided by knowing exactly what was going on- which I now do. If anyone needs any advice, please feel free to post here and I will do my best to provide the appropriate resources.

I will say that this was a really really tough job to do- going into it I had never even touched an Exchange database or transaction log except to break them. The issue was that last month I performed a full server format and install. The backups were not working, and the office needed services. so I formatted C: and reinstalled SBS2008. I set up the domain exactly the same- same DNS, IP configurations, even the same software and hardware.

As you might guess, a format and reinstall- even if it is EXACTLY the same- does not restore users mailboxes. So I went about trying to extract the mail items directly from the mailbox database files. This didn’t work, as EXmerge is discontinued. In order to use it to extract .PST files you need to install 32bit Exchange Tools, which I did not have the time nor patience for. If you need to find Exmerge it can be downloaded from Microsoft here, and documentation on the process can be found in KB259688.

I then set about recovering users email. I had just restored the server at this point, to what I though were exactly the same settings as before. Working with Exchange database’s can be nerve-racking if you don’t know what you are doing- they are huge, usually premissioned away from normal access, located in one of several places on a server. I though I would just try to stick the database back in and turn on Exchange to see if it worked. So I navigated to D:/Program Files/Microsoft/Exchange Server/Mailbox/. I then dismounted the Exchange databases from inside of EMC, and stopped Exchange services including Information Store and Transport. I renamed the First Information Store folder to First Information StoreOLD, and created a new folder. I then copied all of the Exchange files that I extracted from the backup, using legacy NTBackup. I had a script on the old server that ran a NTBackup of Exchange.

(This is a good practice by the way, which allows me to mess with Exchange backups without restoring other things on the server. NTBackup can be found here, and some tips on using it are here. Mind you the tutorial is for SBS 2003, but the general gist is applied to the newer version.)
So, after all of the files copied over, I restarted Exchange. I ran the BPA, and got some major errors about not being able to mount the stores. I then tried to run the database recovery tools on them, still getting the you-broke-exchange errors.

Uh-oh. What the heck am I doing? So I reversed all of that, and put it on a back burner for a bit. I calmly explained to users that they lost years worth of email and had to deal with it- oh boy. But wait… There is another solution, at least temporarily. Since the domain is the same, but the workstations had not yet been rejoined to the domain, old logon credentials might exist. I sat down with a user to log in, and got a security error. Darn. So I unplugged the workstation from the network, and we then logged on using old cached credentials.

We open up Microsoft Office Outlook. Hit File, Export (or appropriate), and exported Inbox, Sent Items, Contacts, and Calendars to .PST files. We saved them on the root of C: drive, anywhere in the current profile would be lost once we left the domain. At this point we plug the workstation in and then I join it to the domain using Computer>Properties>Network ID. The domain solace.local is already there, and that is the same domain name as well. So I delete the .local, and rejoin the solace domain. Reboot, have the user log in/create a new profile/change password/etc. Open up Outlook, and reverse the export process, importing the .PST files. All of their items were then added to their NEW Exchange mailbox.

The only problem came up when I got to the 20 users who did not have Outlook, and who worked remotely using OWA. How can you export .PST files from OWA? Well, you can’t. So these users I had to explain to them how badly I sucked, and that it wasn’t my fault, and that this sort of thing happens, and that no- we had not planned a disaster recovery plan. Pretty much anything so I could go hom and go to sleep.

I put this on the back burner for a week, asking users to contact people about resending them mail, or whatever they had to do to get by. I then set to researching Exchange Recovery Storage Groups. Great tutorials here and here.

I then realized that I had not applied SP2 to Exchange 2007, which had been applied before the re-install. Sweet- so I downloaded and ran the Exchange SP2 Install Tool from MS. Ran Exchange SP2, which succeeded. Restarted the server, made sure all my services were up and running- Transport was not, so I started that. As far as I could tell, everything was peachy. Gonna continue this in a new post..

%d bloggers like this: