I was recently on a customer's site and was trying to prepare the schema for an installation of Exchange 2013 SP1 this summer. The client currently use a hybrid setup with on premise Exchange 2010 SP3 and Office 365.
I downloaded the Exchange 2013 media, logged on to the DC with the schema master role and began to run the following command:-
Setup.exe /PrepareSchema /IAcceptExchangeServerLicenseTerms
It instantly failed and threw this error...
Performing Microsoft Exchange Server Prerequisite Check
Prerequisite Analysis FAILED
A hybrid deployment with Office 365 has been detected. Please ensure that you are running setup with the /TenantOrganizationConfig switch. To use the TenantOrganizationConfig switch you must first connect to your Exchange Online tenant via PowerShell and execute the following command: "Get-OrganizationConfig | Export-Clixml -Path MyTenantOrganizationConfig.XML". Once the XML file has been generated, run setup with the TenantOrganizationConfig switch as follows "/TenantOrganizationConfig myTenantOrganizationConfig.XML".
It turns out that there is very specific syntax to use when combining /PrepareSchema and /TenantOrganizationConfig. I will bullet-point the process so it's easier to follow:-
I opened up PowerShell and ran the following commands to download a copy of the XML file Setup.exe was requesting:-
$UserCredential = Get-Credential
(at this point enter credentials for your Office 365 Global Admin account)
Connect to Office 365
$Session = New-PSSession -ConfigurationName Microsoft.Exchange -ConnectionUri https://ps.outlook.com/powershell/ -Credential $LiveCred -Authentication Basic -AllowRedirection
Import PowerShell Session
Download Hybrid XML File
Get-OrganizationConfig | Export-Clixml -Path C:\MyTenantOrganizationConfig.XML
Move the XML File
Move MyTenantOrganizationConfig.XML file from C:\ of local computer to C:\ of the server you are running Setup.exe from
Setup /PrepareAD /IAcceptExchangeServerLicenseTerms /TenantOrganizationConfig:C:\MyTenantOrganizationConfig.XML
You should now have an extended AD schema ready for Exchange 2013!
Hope this helps.