Controlling AutoDiscover during an Exchange Migration

Having to control Auto Discover during an Exchange Migration where Quest Migration Manager is being used comes up every time.  Here is an example, including scripts, on how this can be done.

There are many articles about the topic of controlling autodiscover in Exchange, with some of those bing from th Coherence site.  For instance, here is a great discussion frrom Alex on the topic Exchange Autodiscover and SCPs.  However, the only examples I have found for sripting this have been from my own hard drive, so I thought I would share.

Why do we have to control AutoDiscover when doing a migration with Quest Migration Manager for Exchange?  Because in its detault configuration Quest Migration Manager for Exchange (QMM) creates a mailbox enabled account during directory synchronization.  If QMM created a mail enabled account this would not cause a problem.  And there is a method for doing that now in QMM, creating a mil-enabled account, but that method assumes you are going to use the “native move” functionality.  So assuming you are using Legacy agents or the MAgE for sync/switch, for now you have mailboxes in two places and can run into autoDiscover issues.

During the migration one of the AutoDiscover checks is a check of the SCP record.  If your workstation and your active mailbox are in different forests, autoDiscover will kick in.   Another time it can come up is if you are keeping the source e-mail address space and you have Outlook Anywhere (eg rpc over http) clients working from outside your network (not vpn’d).  In these cases you will need to be able to control autoDiscover during the migration period.

If your source is Exchange 2003 you can turn off all registry keys until the mailbox is migrated.  If you do this in a source that has Exchange 2007 or higher you will break out of office messaging and free busy look-ups, so not advisable.

You can use the “deny SCP read” approach to controlling Autodiscover, but that breaks down if you have Outlook Anywhere clients.

If that happens, then my next favorite approach isset PreferLocalXML registry keys and control Autodiscover via a local file.

In my example below the customer had three address spaces.

Here is a script I used recently at another customer.

SetPreferLocal.cmd:

@echo off

IF NOT EXIST %temp%\CPUU md %temp%\CPUU

EM If running with cached creds assign a value to logonserver.
IF "%LOGONSERVER%" EQU "" set LOGONSERVER=\\DomainController

REM  copy files local if needed
IF EXIST %temp%\CPUU\autodiscover.xml GOTO RegKeys
copy %LOGONSERVER%\Netlogon\CPUU\autodiscover.xml %temp%\CPUU /y
copy %LOGONSERVER%\Netlogon\CPUU\target.xml %temp%\CPUU /y
copy %LOGONSERVER%\Netlogon\CPUU\source.xml %temp%\CPUU /y
Goto Regkeys

REM Add Reg Keys
:Regkeys
REM Check for office 2013
set officever=14.0
reg query HKCU\Software\Microsoft\Office\15.0 /ve
if %errorlevel% equ 0 set officever=15.0

REM Set Reg Keys
reg add HKCU\Software\Microsoft\Office\%officever%\Outlook\AutoDiscover /v ExcludeHttpRedirect /t REG_DWORD /d 1 /f
reg add HKCU\Software\Microsoft\Office\%officever%\Outlook\AutoDiscover /v ExcludeHttpsAutoDiscoverDomain /t REG_DWORD /d 1 /f
reg add HKCU\Software\Microsoft\Office\%officever%\Outlook\AutoDiscover /v ExcludeHttpsRootDomain /t REG_DWORD /d 1 /f
reg add HKCU\Software\Microsoft\Office\%officever%\Outlook\AutoDiscover /v PreferLocalXML /t REG_DWORD /d 1 /f
reg add HKCU\Software\Microsoft\Office\%officever%\Outlook\AutoDiscover /v ExcludeScpLookup /t REG_DWORD /d 1 /f
reg add HKCU\Software\Microsoft\Office\%officever%\Outlook\AutoDiscover /v ExcludeSrvLookup /t REG_DWORD /d 1 /f
reg add HKCU\Software\Microsoft\Office\%officever%\Outlook\AutoDiscover /v ExcludeSrvRecord /t REG_DWORD /d 1 /f
reg add HKCU\Software\Microsoft\Office\%officever%\Outlook\AutoDiscover /v company1.com /t REG_SZ  /d %temp%\CPUU\autodiscover.xml  /f
reg add HKCU\Software\Microsoft\Office\%officever%\Outlook\AutoDiscover /v xopmany2.com /t REG_SZ  /d %temp%\CPUU\autodiscover.xml  /f
reg add HKCU\Software\Microsoft\Office\%officever%\Outlook\AutoDiscover /v company3.net /t REG_SZ  /d %temp%\CPUU\autodiscover.xml  /f

 

This script must be run as a user login scrip since it is updating Current User.  A GPO will do, or you can also use software deployment if you have that available.

The script is pretty straight forward, so no need to explain much.  Copy the files, set the keys, call it done.

Note that I use this often in combination with the Client Profile Updating Utility (CPUU) script (which I still want to call emwprof).  You can see my post about that script here.

(Edit:  Change how to generate the XML files.  The approach listed in the strike through below has some gaps with additional services and/or differing names for internal and external.)

My source.xml and target.xml I get my exporting it from outlook and then making it a bit more generic.  To export Autodiscover from Outlook control-right-clock on outlook icon in system tray, pick Test E-mail Autoconfiguration, uncheck all but Use AutoDiscover, and hit go.  You can then cut-and-paste from the XML tab.

My source.xml and target.xml I create manually.  The key part is this reference to a generic HTTP get XML file:

<?xml version=”1.0″ encoding=”utf-8″?>

<Autodiscover xmlns=”https://schemas.microsoft.com/exchange/autodiscover/responseschema/2006″><Response

xmlns=”https://schemas.microsoft.com/exchange/autodiscover/outlook/responseschema/2006a”>
<Account>
<AccountType>email</AccountType>
<Action>settings</Action>
<Protocol>
<Type>EXCH</Type>
<Server>FQDN of your Exchange/CAS server</Server>
</Protocol>
</Account>
</Response></Autodiscover>

I pulled the above example from this post, though you can find it in other places as well (this is just the first one google took me to).

Hopefully this will provide some help.