protected void CreateTargetEdbDirectory()
        {
            TDataObject dataObject = this.DataObject;
            string      pathName   = dataObject.EdbFilePath.PathName;

            try
            {
                base.WriteVerbose(Strings.VerboseCheckFileExistenceCondition(this.m_server.Fqdn, pathName));
                bool        flag          = false;
                string      directoryName = Path.GetDirectoryName(pathName);
                TDataObject dataObject2   = this.DataObject;
                if (string.Compare(dataObject2.LogFolderPath.PathName, directoryName, StringComparison.InvariantCultureIgnoreCase) != 0)
                {
                    TDataObject dataObject3 = this.DataObject;
                    if (string.Compare(dataObject3.SystemFolderPath.PathName, directoryName, StringComparison.InvariantCultureIgnoreCase) != 0)
                    {
                        goto IL_82;
                    }
                }
                flag = true;
IL_82:
                if (!flag)
                {
                    SystemConfigurationTasksHelper.TryCreateDirectory(this.m_server.Fqdn, directoryName, Database_Directory.GetDomainWidePermissions(), new Task.TaskVerboseLoggingDelegate(base.WriteVerbose), new Task.TaskWarningLoggingDelegate(this.WriteWarning));
                }
            }
            catch (WmiException)
            {
                this.WriteWarning(Strings.FailedToGetCopyEdbFileStatus(this.m_server.Fqdn, pathName));
            }
        }
예제 #2
0
 protected override void InternalProcessRecord()
 {
     TaskLogger.LogEnter();
     base.InternalProcessRecord();
     if (!this.SkipDatabaseLogFolderCreation)
     {
         string directoryName = Path.GetDirectoryName(this.EdbFilePath.PathName);
         SystemConfigurationTasksHelper.TryCreateDirectory(this.ownerServer.Fqdn, directoryName, Database_Directory.GetDomainWidePermissions(), new Task.TaskVerboseLoggingDelegate(base.WriteVerbose), new Task.TaskWarningLoggingDelegate(this.WriteWarning));
         SystemConfigurationTasksHelper.TryCreateDirectory(this.ownerServer.Fqdn, this.LogFolderPath.PathName, Database_Directory.GetDomainWidePermissions(), new Task.TaskVerboseLoggingDelegate(base.WriteVerbose), new Task.TaskWarningLoggingDelegate(this.WriteWarning));
     }
     TaskLogger.LogExit();
 }
예제 #3
0
        private bool TryCopyPath(string originalPath, string newPath, WmiWrapper.FileFilter filter)
        {
            bool result = true;

            try
            {
                if (SystemConfigurationTasksHelper.TryCreateDirectory(this.ownerServer.Fqdn, newPath, Database_Directory.GetDomainWidePermissions(), new Task.TaskVerboseLoggingDelegate(base.WriteVerbose), new Task.TaskWarningLoggingDelegate(this.WriteWarning)))
                {
                    base.WriteVerbose(Strings.VerboseCheckDirectoryExistenceCondition(this.OwnerServer.Fqdn, originalPath));
                    if (WmiWrapper.IsDirectoryExisting(this.OwnerServer.Fqdn, originalPath))
                    {
                        base.WriteVerbose(Strings.VerboseCopyDirectory(this.OwnerServer.Fqdn, originalPath, newPath));
                        if (!WmiWrapper.CopyFilesInDirectory(this.OwnerServer.Fqdn, originalPath, newPath, filter))
                        {
                            result = false;
                        }
                    }
                    else
                    {
                        TaskLogger.Trace("Original directory does not exist, nothing to copy.", new object[0]);
                    }
                }
                else
                {
                    result = false;
                }
            }
            catch (ManagementException ex)
            {
                base.WriteVerbose(Strings.VerboseEatUpException(ex.Message));
                TaskLogger.Trace("Error occurs when copying path: {0}", new object[]
                {
                    ex.Message
                });
                result = false;
            }
            return(result);
        }
        internal void SeedDatabase(ReplayConfiguration config)
        {
            ReplayState replayState = config.ReplayState;

            if (config is RemoteReplayConfiguration)
            {
                string targetMachine = config.TargetMachine;
                try
                {
                    string      machineFqdn        = targetMachine;
                    string      destinationLogPath = config.DestinationLogPath;
                    string      destinationEdbPath = config.DestinationEdbPath;
                    TDataObject dataObject         = this.DataObject;
                    AddDatabaseCopyTaskBase <TDataObject> .CheckSeedingPath(machineFqdn, destinationLogPath, destinationEdbPath, dataObject.LogFilePrefix);
                }
                catch (SeedingPathWarningException ex)
                {
                    if (this.m_SeedingPostponedSpecified)
                    {
                        base.WriteWarning(ex.Message);
                    }
                    return;
                }
                catch (SeedingPathErrorException exception)
                {
                    base.WriteError(exception, ErrorCategory.InvalidOperation, this.Identity);
                }
                SystemConfigurationTasksHelper.TryCreateDirectory(this.m_server.Fqdn, config.DestinationLogPath, Database_Directory.GetDomainWidePermissions(), new Task.TaskVerboseLoggingDelegate(base.WriteVerbose), new Task.TaskWarningLoggingDelegate(this.WriteWarning));
                using (TaskSeeder taskSeeder = this.ConstructSeeder())
                {
                    taskSeeder.SeedDatabase();
                }
                return;
            }
            throw new NotSupportedException(config.GetType() + " is not supported");
        }
예제 #5
0
        protected override void InternalProcessRecord()
        {
            TaskLogger.LogEnter(new object[]
            {
                this.DataObject
            });
            bool       flag   = false;
            bool       flag2  = false;
            bool       flag3  = true;
            bool       flag4  = false;
            bool       flag5  = false;
            Server     server = this.OwnerServer;
            ADObjectId id     = new ADObjectId(this.OwnerServer.Guid);

            if (server == null)
            {
                base.WriteError(new InvalidOperationException(Strings.ErrorDBOwningServerNotFound(this.DataObject.Identity.ToString())), ErrorCategory.InvalidOperation, this.DataObject.Identity);
            }
            try
            {
                if ((!this.IsEdbFilePathChanged && !this.isLogFolderPathChanged) || (base.ConfigurationOnly && !this.shouldContinueToDoConfigurationOnly))
                {
                    TaskLogger.LogExit();
                }
                else
                {
                    if (this.needReportProgress)
                    {
                        base.WriteProgress(Strings.ProgressMoveDatabasePath(this.Identity.ToString()), Strings.ProgressCheckingReplayState, 10);
                    }
                    base.WriteVerbose(Strings.VerboseConnectionAdminRpcInterface(this.OwnerServer.Fqdn));
                    MdbStatus mdbStatus = AmStoreHelper.GetMdbStatus(this.OwnerServer.Fqdn, this.DataObject.Guid);
                    if (mdbStatus == null)
                    {
                        base.WriteError(new InvalidOperationException(Strings.ErrorFailedToGetDatabaseStatus(this.Identity.ToString())), ErrorCategory.InvalidOperation, this.Identity);
                    }
                    if ((mdbStatus.Status & MdbStatusFlags.Backup) != MdbStatusFlags.Offline)
                    {
                        base.WriteError(new InvalidOperationException(Strings.ErrorBackupInProgress(this.Identity.ToString())), ErrorCategory.InvalidOperation, this.Identity);
                    }
                    else if ((mdbStatus.Status & MdbStatusFlags.Online) != MdbStatusFlags.Offline)
                    {
                        if (!this.Force && !base.ShouldContinue(base.ConfigurationOnly ? Strings.WarningDismountDatabaseToDoConfigurationOnly(this.Identity.ToString()) : Strings.WarningDismountDatabaseToContinue(this.Identity.ToString())))
                        {
                            TaskLogger.LogExit();
                            return;
                        }
                        if (this.needReportProgress)
                        {
                            base.WriteProgress(Strings.ProgressMoveDatabasePath(this.Identity.ToString()), Strings.ProgressDismountingDatabase(this.Identity.ToString()), 20);
                        }
                        base.WriteVerbose(TaskVerboseStringHelper.GetReadObjectVerboseString(id, base.DataSession, typeof(Server)));
                        try
                        {
                            base.WriteVerbose(Strings.VerboseUnmountDatabase(this.DataObject.Identity.ToString()));
                            AmRpcClientHelper.DismountDatabase(ADObjectWrapperFactory.CreateWrapper(this.DataObject), 0);
                        }
                        catch (AmServerException ex)
                        {
                            Exception ex2;
                            if (ex.TryGetInnerExceptionOfType(out ex2))
                            {
                                TaskLogger.Trace("MoveDatabasePath.InternalProcessRecord raises exception while unmounting database: {0}", new object[]
                                {
                                    ex2.Message
                                });
                            }
                            else if (ex.TryGetInnerExceptionOfType(out ex2))
                            {
                                TaskLogger.Trace("MoveDatabasePath.InternalProcessRecord raises exception while unmounting database: {0}", new object[]
                                {
                                    ex2.Message
                                });
                            }
                            else if (ex is AmDatabaseNeverMountedException)
                            {
                                TaskLogger.Trace("MoveDatabasePath.InternalProcessRecord raises exception while unmounting database: {0}", new object[]
                                {
                                    ex.Message
                                });
                            }
                            else
                            {
                                TaskLogger.Trace("MoveDatabasePath.InternalProcessRecord raises exception while unmounting database: {0}", new object[]
                                {
                                    ex.Message
                                });
                                base.WriteError(ex, ErrorCategory.InvalidOperation, this.DataObject.Identity);
                            }
                        }
                        catch (AmServerTransientException ex3)
                        {
                            TaskLogger.Trace("MoveDatabasePath.InternalProcessRecord raises exception while dismounting database: {0}", new object[]
                            {
                                ex3.Message
                            });
                            base.WriteError(ex3, ErrorCategory.InvalidOperation, this.DataObject.Identity);
                        }
                        flag = true;
                    }
                    if (!base.ConfigurationOnly)
                    {
                        if (this.IsDatabaseFilesCreated && this.IsEdbFilePathChanged)
                        {
                            if (this.needReportProgress)
                            {
                                base.WriteProgress(Strings.ProgressMoveDatabasePath(this.Identity.ToString()), Strings.ProgressCopyingEdbFile, 25);
                            }
                            if (!this.TryCopyFile(this.OriginalEdbFilePath.PathName, this.TargetEdbFilePath.PathName))
                            {
                                base.WriteError(new InvalidOperationException(Strings.ErrorFailedToMoveEdbFile(this.OriginalEdbFilePath.PathName, this.TargetEdbFilePath.PathName)), ErrorCategory.InvalidOperation, this.Identity);
                            }
                            flag2 = true;
                        }
                        if (this.isLogFolderPathChanged)
                        {
                            if (this.needReportProgress)
                            {
                                base.WriteProgress(Strings.ProgressMoveDatabasePath(this.Identity.ToString()), Strings.ProgressCopyingLogFiles, 45);
                            }
                            base.WriteVerbose(Strings.VerboseCopyDatabaseLogFiles(base.OwnerServerName, this.OldLogFolderPath.PathName, this.LogFolderPath.PathName));
                            if (!this.TryCopyPath(this.OldLogFolderPath.PathName, this.LogFolderPath.PathName, new WmiWrapper.FileFilter(this.LogFileFilter)))
                            {
                                base.WriteError(new InvalidOperationException(Strings.ErrorFailedToMoveDatabaseLogFiles(this.OldLogFolderPath.PathName, this.LogFolderPath.PathName)), ErrorCategory.InvalidOperation, this.DataObject.Identity);
                            }
                            flag4 = true;
                        }
                    }
                    if (this.needReportProgress)
                    {
                        base.WriteProgress(Strings.ProgressMoveDatabasePath(this.Identity.ToString()), Strings.ProgressSavingADObject, 69);
                    }
                    base.InternalProcessRecord();
                    flag3 = false;
                    if (flag2)
                    {
                        if (this.needReportProgress)
                        {
                            base.WriteProgress(Strings.ProgressMoveDatabasePath(this.Identity.ToString()), Strings.ProgressDeletingEdbFile, 72);
                        }
                        if (!this.TryDeleteFile(this.OriginalEdbFilePath.PathName))
                        {
                            this.WriteWarning(Strings.FailedToDeleteOldEdbFile(this.OriginalEdbFilePath.PathName));
                            TaskLogger.Trace("MoveDatabasePath: delete edb \"{0}\" file failed", new object[]
                            {
                                this.OriginalEdbFilePath.PathName
                            });
                        }
                    }
                    if (flag4)
                    {
                        if (this.needReportProgress)
                        {
                            base.WriteProgress(Strings.ProgressMoveDatabasePath(this.Identity.ToString()), Strings.ProgressDeletingLogFiles, 81);
                        }
                        base.WriteVerbose(Strings.VerboseDeleteDatabaseLogFiles(this.OwnerServer.Fqdn, this.OldLogFolderPath.PathName));
                        if (!WmiWrapper.DeleteFilesInDirectory(this.OwnerServer.Fqdn, this.OldLogFolderPath.PathName, new WmiWrapper.FileFilter(this.LogPathFilter)))
                        {
                            this.WriteWarning(Strings.FailedDeleteOldDatabaseLogFiles(this.OwnerServer.Fqdn, this.OldLogFolderPath.PathName));
                            TaskLogger.Trace("Failed to delete some of the orignal log files.", new object[0]);
                        }
                    }
                    if (this.moveCatalogs && SystemConfigurationTasksHelper.TryCreateDirectory(this.OwnerServer.Fqdn, this.targetCatalogsPath, null, new Task.TaskVerboseLoggingDelegate(base.WriteVerbose), new Task.TaskWarningLoggingDelegate(this.WriteWarning)))
                    {
                        if (this.needReportProgress)
                        {
                            base.WriteProgress(Strings.ProgressMoveDatabasePath(this.Identity.ToString()), Strings.ProgressCopyingCatalog, 87);
                        }
                        try
                        {
                            base.WriteVerbose(Strings.VerboseCopyDatabaseCatalogFiles(this.OwnerServer.Fqdn, this.originalCatalogsPath, this.targetCatalogsPath));
                            if (WmiWrapper.CopyFilesInDirectory(this.OwnerServer.Fqdn, this.originalCatalogsPath, this.targetCatalogsPath, new WmiWrapper.FileFilter(MoveDatabasePath.ReturnAllFiles)))
                            {
                                if (this.needReportProgress)
                                {
                                    base.WriteProgress(Strings.ProgressMoveDatabasePath(this.Identity.ToString()), Strings.ProgressDeletingCatalog, 92);
                                }
                                base.WriteVerbose(Strings.VerboseDeleteDatabaseCatalogFiles(this.OwnerServer.Fqdn, this.originalCatalogsPath));
                                WmiWrapper.DeleteFilesInDirectory(this.OwnerServer.Fqdn, this.originalCatalogsPath, new WmiWrapper.FileFilter(MoveDatabasePath.ReturnAllFiles));
                                base.WriteVerbose(Strings.VerboseDeleteDirectory(this.OwnerServer.Fqdn, this.originalCatalogsPath));
                                WmiWrapper.RemoveDirectory(this.OwnerServer.Fqdn, this.originalCatalogsPath);
                            }
                        }
                        catch (ManagementException ex4)
                        {
                            TaskLogger.Trace("MoveDatabasePath raised exception {0} while moving catalog files", new object[]
                            {
                                ex4.ToString()
                            });
                            this.WriteWarning(Strings.ErrorMovingCatalogs(this.Identity.ToString(), ex4.Message));
                        }
                        catch (ArgumentException ex5)
                        {
                            TaskLogger.Trace("MoveDatabasePath raised exception {0} while moving catalog files", new object[]
                            {
                                ex5.ToString()
                            });
                            this.WriteWarning(Strings.ErrorMovingCatalogs(this.Identity.ToString(), ex5.Message));
                        }
                    }
                    this.SendNotificationRpcToReplayService();
                    flag5 = true;
                }
            }
            catch (WmiException ex6)
            {
                base.WriteError(new InvalidOperationException(Strings.ErrorFailedToConnectToServer(base.OwnerServerName, ex6.Message)), ErrorCategory.InvalidOperation, this.Identity);
            }
            catch (UnauthorizedAccessException ex7)
            {
                base.WriteError(new InvalidOperationException(Strings.ErrorFailedToConnectToServer(base.OwnerServerName, ex7.Message)), ErrorCategory.InvalidOperation, this.Identity);
            }
            finally
            {
                if (flag3)
                {
                    if (flag2 && !this.TryDeleteFile(this.TargetEdbFilePath.PathName))
                    {
                        this.WriteWarning(Strings.FailedToDeleteTempEdbFile(this.TargetEdbFilePath.PathName));
                        TaskLogger.Trace("MoveDatabasePath: delete edb \"{0}\" file failed", new object[]
                        {
                            this.TargetEdbFilePath.PathName
                        });
                    }
                    if (flag4)
                    {
                        TaskLogger.Trace("Error occurs when Copying path. delete copied log files", new object[0]);
                        base.WriteVerbose(Strings.VerboseDeleteDatabaseLogFiles(this.OwnerServer.Fqdn, this.LogFolderPath.PathName));
                        if (!WmiWrapper.DeleteFilesInDirectory(this.OwnerServer.Fqdn, this.LogFolderPath.PathName, new WmiWrapper.FileFilter(this.LogFileFilter)))
                        {
                            this.WriteWarning(Strings.FailedDeleteTempDatabaseLogFiles(base.OwnerServerName, this.LogFolderPath.PathName));
                            TaskLogger.Trace("Failed to delete some of the copied log files.", new object[0]);
                        }
                    }
                }
                if (!base.ConfigurationOnly && flag)
                {
                    if (this.needReportProgress)
                    {
                        base.WriteProgress(Strings.ProgressMoveDatabasePath(this.Identity.ToString()), Strings.ProgressRestoringDatabaseStatus, 95);
                    }
                    base.WriteVerbose(TaskVerboseStringHelper.GetReadObjectVerboseString(id, base.DataSession, typeof(Server)));
                    try
                    {
                        if (!flag5)
                        {
                            this.SendNotificationRpcToReplayService();
                            flag5 = true;
                        }
                        base.WriteVerbose(Strings.VerboseMountDatabase(this.Identity.ToString()));
                        AmRpcClientHelper.MountDatabase(ADObjectWrapperFactory.CreateWrapper(this.DataObject), 0, 0, 0);
                    }
                    catch (AmServerException ex8)
                    {
                        string message = ex8.Message;
                        TaskLogger.Trace("MoveDatabasePath.InternalProcessRecord raises exception while re-mounting Mdb status: {0}", new object[]
                        {
                            message
                        });
                        this.WriteWarning(Strings.ErrorFailedToRestoreDatabaseStatus(this.Identity.ToString(), message));
                    }
                    catch (AmServerTransientException ex9)
                    {
                        string message2 = ex9.Message;
                        TaskLogger.Trace("MoveDatabasePath.InternalProcessRecord raises exception while re-mounting Mdb status: {0}", new object[]
                        {
                            message2
                        });
                        this.WriteWarning(Strings.ErrorFailedToRestoreDatabaseStatus(this.Identity.ToString(), message2));
                    }
                }
                TaskLogger.LogExit();
            }
        }
예제 #6
0
        protected override void InternalValidate()
        {
            TaskLogger.LogEnter();
            base.InternalValidate();
            if (this.OwnerServer == null)
            {
                base.WriteError(new InvalidOperationException(Strings.ErrorDBOwningServerNotFound(this.DataObject.Identity.ToString())), ErrorCategory.InvalidOperation, this.DataObject.Identity);
            }
            base.VerifyIsWithinScopes((IConfigurationSession)base.DataSession, this.OwnerServer, true, new DataAccessTask <Database> .ADObjectOutOfScopeString(Strings.ErrorServerOutOfScope));
            if (this.DataObject != null)
            {
                MapiTaskHelper.VerifyDatabaseAndItsOwningServerInScope(base.SessionSettings, this.DataObject, new Task.ErrorLoggerDelegate(base.WriteError));
            }
            ADObjectId adobjectId = new ADObjectId(this.OwnerServer.Guid);

            if (null == this.EdbFilePath && (base.Fields.IsModified("EdbFilePath") || base.Fields.IsChanged("EdbFilePath")))
            {
                base.WriteError(new ArgumentException(Strings.ErrorInvalidParameterValue("EdbFilePath", "null"), "EdbFilePath"), ErrorCategory.InvalidArgument, this.Identity);
            }
            if (!this.IsEdbFilePathChanged && !this.isLogFolderPathChanged)
            {
                this.WriteWarning(Strings.FileLocationNotChanged);
                TaskLogger.LogExit();
                return;
            }
            this.needReportProgress = !base.ConfigurationOnly;
            this.shouldContinueToDoConfigurationOnly = true;
            try
            {
                QueryFilter            filter     = new ComparisonFilter(ComparisonOperator.NotEqual, ADObjectSchema.Guid, this.DataObject.Guid);
                ADObjectId             rootId     = this.DataObject.IsExchange2009OrLater ? this.DataObject.AdministrativeGroup.GetChildId("Databases") : this.DataObject.Server;
                IEnumerable <Database> collection = base.DataSession.FindPaged <Database>(filter, rootId, true, null, 0);
                List <Database>        databases  = new List <Database>(collection);
                if (this.IsEdbFilePathChanged)
                {
                    if (this.DataObject.IsExchange2009OrLater)
                    {
                        base.WriteVerbose(Strings.VerboseEdbFileLocationUniqueUnderDAGCondition(this.EdbFilePath.PathName));
                        ADObjectId[] serversId;
                        if (this.DataObject.Servers != null && this.DataObject.Servers.Length != 0)
                        {
                            serversId = this.DataObject.Servers;
                        }
                        else
                        {
                            serversId = new ADObjectId[]
                            {
                                this.DataObject.Server
                            };
                        }
                        if (!new EdbFileLocationUniqueUnderDAGCondition(this.EdbFilePath.PathName, adobjectId, serversId, databases).Verify())
                        {
                            base.WriteError(new ArgumentException(Strings.ErrorEdbFileLocationNotUniqueUnderSameDAG(this.EdbFilePath.PathName), "EdbFilePath"), ErrorCategory.InvalidArgument, this.Identity);
                        }
                    }
                    else
                    {
                        base.WriteVerbose(Strings.VerboseEdbFileLocationUniqueUnderServerCondition(base.OwnerServerName, this.EdbFilePath.PathName));
                        if (!new EdbFileLocationUniqueUnderServerCondition(this.EdbFilePath.PathName, adobjectId, databases).Verify())
                        {
                            base.WriteError(new ArgumentException(Strings.ErrorEdbFileLocationNotUniqueUnderSameNode(this.EdbFilePath.PathName, base.OwnerServerName), "EdbFilePath"), ErrorCategory.InvalidArgument, this.Identity);
                        }
                    }
                }
                if (this.isLogFolderPathChanged)
                {
                    if (this.DataObject.IsExchange2009OrLater)
                    {
                        ADObjectId[] serversId2;
                        if (this.DataObject.Servers != null && this.DataObject.Servers.Length != 0)
                        {
                            serversId2 = this.DataObject.Servers;
                        }
                        else
                        {
                            serversId2 = new ADObjectId[]
                            {
                                this.DataObject.Server
                            };
                        }
                        if (!new DbLogLocationUniqueUnderDAGCondition(this.LogFolderPath.PathName, adobjectId, serversId2, databases).Verify())
                        {
                            base.WriteError(new ArgumentException(Strings.ErrorLogFolderPathNotUniqueUnderSameDAG(this.LogFolderPath.PathName), "LogFolderPath"), ErrorCategory.InvalidArgument, this.DataObject.Identity);
                        }
                    }
                    else if (!new DbLogLocationUniqueUnderServerCondition(this.LogFolderPath.PathName, adobjectId, databases).Verify())
                    {
                        base.WriteError(new ArgumentException(Strings.ErrorLogFolderPathNotUniqueUnderTheSameNode(this.LogFolderPath.PathName, base.OwnerServerName), "LogFolderPath"), ErrorCategory.InvalidArgument, this.DataObject.Identity);
                    }
                }
                if (base.ConfigurationOnly)
                {
                    this.moveCatalogs = false;
                    if (!this.Force && !(this.shouldContinueToDoConfigurationOnly = base.ShouldContinue(Strings.WarningUseConfigurationOnly)))
                    {
                        TaskLogger.LogExit();
                        return;
                    }
                    if (this.IsEdbFilePathChanged)
                    {
                        base.WriteVerbose(Strings.VerboseCheckFileExistenceCondition(base.OwnerServerName, this.TargetEdbFilePath.PathName));
                        if (new FileNotExistCondition(this.OwnerServer.Fqdn, this.TargetEdbFilePath.PathName).Verify())
                        {
                            this.WriteWarning(Strings.WarningEdbFileLocationNotExists(this.EdbFilePath.PathName));
                        }
                    }
                    TaskLogger.LogExit();
                    return;
                }
                else
                {
                    if (this.needReportProgress)
                    {
                        base.WriteProgress(Strings.ProgressValidatingFileLocations, Strings.ProgressMoveDatabasePath(this.Identity.ToString()), 5);
                    }
                    if (this.IsEdbFilePathChanged)
                    {
                        if (this.OriginalEdbFilePath == null)
                        {
                            base.WriteError(new InvalidOperationException(Strings.ErrorOriginalEdbFilePathMissed(this.Identity.ToString())), ErrorCategory.InvalidOperation, this.Identity);
                        }
                        if (this.IsDatabaseFilesCreated)
                        {
                            base.WriteVerbose(Strings.VerboseCheckFileExistenceCondition(base.OwnerServerName, this.OriginalEdbFilePath.PathName));
                            if (new FileNotExistCondition(this.OwnerServer.Fqdn, this.OriginalEdbFilePath.PathName).Verify())
                            {
                                base.WriteError(new InvalidOperationException(Strings.ErrorSourceFileNotFound(base.OwnerServerName, this.OriginalEdbFilePath.PathName)), ErrorCategory.InvalidOperation, this.Identity);
                            }
                        }
                        base.WriteVerbose(Strings.VerbosePathOnFixedOrNetworkDriveCondition(base.OwnerServerName, this.EdbFilePath.PathName));
                        if (!new PathOnFixedOrNetworkDriveCondition(this.OwnerServer.Fqdn, this.EdbFilePath.PathName).Verify())
                        {
                            base.WriteError(new ArgumentException(Strings.ErrorEdbFileLocationNotOnFixedDrive(this.EdbFilePath.PathName), "EdbFilePath"), ErrorCategory.InvalidArgument, this.Identity);
                        }
                        base.WriteVerbose(Strings.VerboseCheckFileExistenceCondition(base.OwnerServerName, this.EdbFilePath.PathName));
                        if (!new FileNotExistCondition(this.OwnerServer.Fqdn, this.EdbFilePath.PathName).Verify())
                        {
                            base.WriteError(new ArgumentException(Strings.ErrorEdbFilePathOccupiedByFile(this.EdbFilePath.PathName, base.OwnerServerName), "EdbFilePath"), ErrorCategory.InvalidArgument, this.Identity);
                        }
                        base.WriteVerbose(Strings.VerboseCheckDirectoryExistenceCondition(base.OwnerServerName, this.EdbFilePath.PathName));
                        if (!new DirectoryNotExistCondition(this.OwnerServer.Fqdn, this.EdbFilePath.PathName).Verify())
                        {
                            base.WriteError(new ArgumentException(Strings.ErrorEdbFilePathOccupiedByDirectory(this.EdbFilePath.PathName, base.OwnerServerName), "EdbFilePath"), ErrorCategory.InvalidArgument, this.Identity);
                        }
                        string directoryName = Path.GetDirectoryName(this.EdbFilePath.PathName);
                        if (this.IsDatabaseFilesCreated && !SystemConfigurationTasksHelper.TryCreateDirectory(this.OwnerServer.Fqdn, directoryName, Database_Directory.GetDomainWidePermissions(), new Task.TaskVerboseLoggingDelegate(base.WriteVerbose), new Task.TaskWarningLoggingDelegate(this.WriteWarning)))
                        {
                            base.WriteError(new ArgumentException(Strings.ErrorEdbFileDirectoryNotExist(directoryName, base.OwnerServerName), "EdbFilePath"), ErrorCategory.InvalidOperation, this.Identity);
                        }
                        if (this.moveCatalogs)
                        {
                            this.moveCatalogs = this.DataObject.ObjectClass.Contains("msExchPrivateMDB");
                            if (this.moveCatalogs)
                            {
                                string directoryName2 = Path.GetDirectoryName(this.OriginalEdbFilePath.PathName);
                                this.originalCatalogsPath = this.GenerateCatalogPath(directoryName2, this.DataObject.Guid);
                                base.WriteVerbose(Strings.VerboseCheckDirectoryExistenceCondition(base.OwnerServerName, this.originalCatalogsPath));
                                this.moveCatalogs = WmiWrapper.IsDirectoryExisting(this.OwnerServer.Fqdn, this.originalCatalogsPath);
                                if (this.moveCatalogs)
                                {
                                    string directoryName3 = Path.GetDirectoryName(this.EdbFilePath.PathName);
                                    this.targetCatalogsPath = this.GenerateCatalogPath(directoryName3, this.DataObject.Guid);
                                    this.moveCatalogs       = (this.originalCatalogsPath != this.targetCatalogsPath);
                                }
                            }
                        }
                    }
                    else
                    {
                        this.moveCatalogs = false;
                    }
                    if (base.ConfigurationOnly)
                    {
                        TaskLogger.LogExit();
                        return;
                    }
                    if (this.isLogFolderPathChanged)
                    {
                        if (this.OldLogFolderPath == null)
                        {
                            base.WriteError(new InvalidOperationException(Strings.ErrorOriginalLogFolderPathIsMissed(this.Identity.ToString())), ErrorCategory.InvalidOperation, this.DataObject.Identity);
                        }
                        base.WriteVerbose(Strings.VerbosePathOnFixedOrNetworkDriveCondition(this.OwnerServer.Fqdn, this.LogFolderPath.PathName));
                        if (!new PathOnFixedOrNetworkDriveCondition(this.OwnerServer.Fqdn, this.LogFolderPath.PathName).Verify())
                        {
                            base.WriteError(new ArgumentException(Strings.ErrorPathIsNotOnFixedDrive("LogFolderPath")), ErrorCategory.InvalidArgument, this.DataObject.Identity);
                        }
                        base.WriteVerbose(Strings.VerboseLogLocationAvailableCondition(this.OwnerServer.Fqdn, this.LogFolderPath.PathName));
                        if (!new LogLocationAvailableCondition(this.OwnerServer.Fqdn, this.LogFolderPath.PathName, this.DataObject.LogFilePrefix).Verify())
                        {
                            base.WriteError(new ArgumentException(Strings.ErrorLogFolderPathNotAvailable, "LogFolderPath"), ErrorCategory.InvalidArgument, this.DataObject.Identity);
                        }
                        base.WriteVerbose(Strings.VerboseCheckLogFileExistingInPath(this.OwnerServer.Fqdn, this.oldLogFolderPath.PathName));
                        if (!WmiWrapper.IsFileExistingInPath(this.OwnerServer.Fqdn, this.oldLogFolderPath.PathName, new WmiWrapper.FileFilter(this.LogFileFilter)))
                        {
                            base.WriteError(new InvalidOperationException(Strings.ErrorMoveDatabasePathAsSourceFileNotExist(this.oldLogFolderPath.PathName)), ErrorCategory.InvalidOperation, this.DataObject.Identity);
                        }
                    }
                }
            }
            catch (WmiException ex)
            {
                base.WriteError(new InvalidOperationException(Strings.ErrorFailedToConnectToServer(base.OwnerServerName, ex.Message)), ErrorCategory.InvalidOperation, this.Identity);
            }
            catch (UnauthorizedAccessException ex2)
            {
                base.WriteError(new InvalidOperationException(Strings.ErrorFailedToConnectToServer(base.OwnerServerName, ex2.Message)), ErrorCategory.InvalidOperation, this.Identity);
            }
            if (this.DataObject.ReplicationType == ReplicationType.Remote && !this.DataObject.Recovery)
            {
                base.WriteError(new InvalidOperationException(Strings.ErrorMoveDatabasePathInvalidOnReplicated), ErrorCategory.InvalidOperation, this.DataObject.Identity);
            }
            TaskLogger.LogExit();
        }