PS F:\> .\Setup.EXE /Prepareschema /IAcceptExchangeServerLicenseTerms /domaincontroller:dc01.azure365pro.local Microsoft Exchange Server 2016 Cumulative Update 17 Unattended Setup Copying Files... File copy complete. Setup will now collect additional information needed for installation. Performing Microsoft Exchange Server Prerequisite Check Prerequisite Analysis COMPLETED Configuring Microsoft Exchange Server Extending Active Directory schema FAILED The following error was generated when "$error.Clear(); install-ExchangeSchema -LdapFileName ($roleInstallPath + "Setup\Data\"+$RoleSchemaPrefix + "schema2.ldf") " was run: "Microsoft.Exchange.Configuration.Tasks.TaskException: There was an error while running 'ldifde.exe' to import the schema file 'C:\windows\Temp\ExchangeSetup\Setup\Data\PostExchange2003_schema2.ldf'. The error code is: 8224. More details can be found in the error file: 'C:\Users\administrator\AppData\Local\Temp\2\ldif.err' at Microsoft.Exchange.Configuration.Tasks.Task.ThrowError(Exception exception, ErrorCategory errorCategory, Object target, String helpUrl) at Microsoft.Exchange.Management.Deployment.InstallExchangeSchema.ImportSchemaFile(String schemaMasterServer, String schemaFilePath, String macroName, String macroValue, WriteVerboseDelegate writeVerbose) at Microsoft.Exchange.Management.Deployment.InstallExchangeSchema.InternalProcessRecord() at Microsoft.Exchange.Configuration.Tasks.Task.<ProcessRecord>b__91_1() at Microsoft.Exchange.Configuration.Tasks.Task.InvokeRetryableFunc(String funcName, Action func, Boolean terminatePipelineIfFailed)". The Exchange Server setup operation didn't complete. More details can be found in ExchangeSetup.log located in the <SystemDrive>:\ExchangeSetupLogs folder. PS F:\>
Solution –
Make sure all Domain Controllers are reachable.
Remove any orphaned domain controllers.
Try running on domain controller itself holding the schema master.