When running /PrepareSchema in an Exchange organisation with an existing Exchange Hybrid deployment you may run into an error which states:
"A hybrid deployment with Office 365 has been detected. Please ensure that you are running setup with the /TenantOrganizationConfig switch"
This is shown below:
setup.exe /IAcceptExchangeServerLicenseTerms_DiagnosticDataON /PrepareSchema
A similar issue will occur if you specify only /PrepareAD
setup.exe /IAcceptExchangeServerLicenseTerms_DiagnosticDataON /PrepareAD
Note that the /TenantOrganizationConfig switch was NOT added, and this caused the command to fail.
The fix is straightforward, so let's take a look.
Solution
There are two parts to the solution.
- Generate tenant XML config file
- Use /PrepareAD along with the tenant XML config file
First up, to generate the tenant XML config file, we need to connect to Exchange Online using PowerShell. Once connected and authenticated, we will save the Exchange Online organisation's details to a local XML file. Note that the present working directory is C:\Source so the file is saved there as a full path was not entered.
Get-OrganizationConfig | Export-Clixml -Path MyTenantOrganizationConfig.XML
For reference, the contents of the XML are show below:
Now that we have the config file, we can use it as part of the preparation process. This is where the second trick comes in.
We can not run /PrepareSchema on its own. This is because we need to provide the /TenantOrganizationConfig but this parameter does not exist with /PrepareSchema. Since it only exists with /PrepareAD we will use that, and it will automatically run /PrepareSchema if the account has the correct permissions (Schema Admin).
The below was executed from an elevated CMD prompt
Setup.exe /IAcceptExchangeServerLicenseTerms_DiagnosticDataON /PrepareAD /TenantOrganizationConfig C:\Source\MyTenantOrganizationConfig.xml
The operation starts, and does the necessary work to perform the /PrepareSchema and /PrepareAD steps.
Now that Active Directory has been prepared, we can continue to install the CU on the individual servers.
Setup Gone Bad
The below are some common issues that I see in the field.As noted above the TenantorganizationConfig switch is not available on the /PrepareSchema command. Should you want to try it, the below error will be your prize.
It is also not valid for /PrepareDomain. You will get the below error.The parameter 'tenantorganizationconfig' is not valid for current operation 'PrepareDomain'.
Setup checks failed: Invalid command line arguments.
Note that you need to specify the location of the XML file. Simply running the sample command as listed in the error description will fail.
For reference the sample command is:
Setup.exe /IAcceptExchangeServerLicenseTerms_DiagnosticDataON /PrepareAD /TenantOrganizationConfig MyTenantOrganizationConfig.xml
You need to specify the location of the XML file.
Setup.exe /IAcceptExchangeServerLicenseTerms_DiagnosticDataON /PrepareAD /TenantOrganizationConfig C:\Source\MyTenantOrganizationConfig.xml
This one was “interesting”. There was an error due to an unexpected hash mismatch.
To align Exchange Online with the on-premises deployment we re-ran the HCW in a change window.
Then we were able to run the /PrepareAD command.
For reference the error log text is shown below:
[10/08/2020 01:50:40.0153] [1] Failed [Rule:DidTenantSettingCreatedAnException] [Message:The OrganizationConfigHash property appears to be from a different Exchange Online tenant than the one you have a hybrid deployment with.]
[10/08/2020 01:50:40.0153] [1] [RECOMENDED] Setup will prepare the organization for Exchange Server 2016 by using 'Setup /PrepareAD'. No Exchange Server 2013 roles have been detected in this topology. After this operation, you will not be able to install any Exchange Server 2013 roles.
[10/08/2020 01:50:40.0165] [1] [REQUIRED] The OrganizationConfigHash property appears to be from a different Exchange Online tenant than the one you have a hybrid deployment with.
Update
Since the command line options for Exchange setup changed, the sample commands in this post were updated so that /IAcceptExchangeServerLicenseTerms was replaced with IAcceptExchangeServerLicenseTerms_DiagnosticDataON
For more details, please see this post on the setup changes introduced in Exchange 2016 CU22 and Exchange 2019 CU11.
Cheers,
Rhoderick
Excellent work here! Thank you.
Could you please update the switch /IAcceptExchangeServerLicenseTerms_DiagnosticDataOFF