Example #1
0
        // Token: 0x06001672 RID: 5746 RVA: 0x00054E80 File Offset: 0x00053080
        private void PreRelease(object sender, EventArgs e)
        {
            ADDriverContext  threadADContext = ADSessionSettings.GetThreadADContext();
            ADServerSettings serverSettings  = (threadADContext != null) ? threadADContext.ServerSettings : null;

            CmdletLogHelper.LogADServerSettingsAfterCmdExecuted(this.context.UniqueId, serverSettings);
        }
Example #2
0
        // Token: 0x06001673 RID: 5747 RVA: 0x00054EB4 File Offset: 0x000530B4
        private void MarkDcDownIfNecessary(GenericEventArg <TaskErrorEventArg> e)
        {
            if (e.Data.ExceptionHandled)
            {
                return;
            }
            ADDriverContext  threadADContext  = ADSessionSettings.GetThreadADContext();
            ADServerSettings adserverSettings = (threadADContext != null) ? threadADContext.ServerSettings : null;

            if (this.context == null || adserverSettings == null)
            {
                return;
            }
            string text = null;

            for (Exception ex = e.Data.Exception; ex != null; ex = ex.InnerException)
            {
                if (ex is SuitabilityDirectoryException)
                {
                    text = ((SuitabilityDirectoryException)ex).Fqdn;
                    break;
                }
                if (ex is ServerInMMException)
                {
                    text = ((ServerInMMException)ex).Fqdn;
                    break;
                }
                if (ex is ADServerSettingsChangedException)
                {
                    ADServerSettings serverSettings = ((ADServerSettingsChangedException)ex).ServerSettings;
                    this.PersistNewServerSettings(serverSettings);
                    break;
                }
                if (ex == ex.InnerException)
                {
                    break;
                }
            }
            if (string.IsNullOrWhiteSpace(text))
            {
                return;
            }
            Fqdn fqdn;

            if (Fqdn.TryParse(text, out fqdn))
            {
                try
                {
                    adserverSettings.MarkDcDown(fqdn);
                    CmdletLogger.SafeAppendGenericInfo(this.context.UniqueId, "MarkDcDown", fqdn);
                    return;
                }
                catch (NotSupportedException)
                {
                    CmdletLogger.SafeAppendGenericInfo(this.context.UniqueId, "MarkDcDown-NotSupportedException", fqdn);
                    return;
                }
            }
            CmdletLogger.SafeAppendGenericInfo(this.context.UniqueId, "MarkDcDown-InvalidFqdn", fqdn);
        }
Example #3
0
 // Token: 0x06001675 RID: 5749 RVA: 0x00055040 File Offset: 0x00053240
 private void PersistNewServerSettings(ADServerSettings newServerSettings)
 {
     if (newServerSettings != null)
     {
         ADSessionSettings.ClearThreadADContext();
         LocalizedString adserverSettings;
         if (CmdletLogHelper.NeedConvertLogMessageToUS)
         {
             adserverSettings = TaskVerboseStringHelper.GetADServerSettings(this.context.InvocationInfo.CommandName, newServerSettings, CmdletLogHelper.DefaultLoggingCulture);
         }
         else
         {
             adserverSettings = TaskVerboseStringHelper.GetADServerSettings(this.context.InvocationInfo.CommandName, newServerSettings);
         }
         if (this.context.SessionState != null)
         {
             CmdletLogger.SafeAppendGenericInfo(this.context.UniqueId, "ADServerSettings-FailOver", adserverSettings);
             ExchangePropertyContainer.SetServerSettings(this.context.SessionState, newServerSettings);
         }
         else
         {
             CmdletLogger.SafeAppendGenericInfo(this.context.UniqueId, "ADServerSettings-NOTFailOver-SessionStateNull", adserverSettings);
         }
         ADSessionSettings.SetThreadADContext(new ADDriverContext(newServerSettings, ContextMode.Cmdlet));
         this.context.ServerSettingsAfterFailOver = newServerSettings;
         this.context.CommandShell.WriteWarning(DirectoryStrings.RunspaceServerSettingsChanged);
         return;
     }
     CmdletLogger.SafeAppendGenericInfo(this.context.UniqueId, "ADServerSettings-NOTFailOver-ServerSettingsNull", "NULL");
 }
Example #4
0
        internal static void SetServerSettings(ISessionState sessionState, ADServerSettings serverSettings)
        {
            ExchangePropertyContainer propertyContainer = ExchangePropertyContainer.GetPropertyContainer(sessionState);

            if (propertyContainer == null)
            {
                throw new ArgumentException("sessionState");
            }
            propertyContainer.serverSettings = serverSettings;
        }
Example #5
0
        private void PropagateExchangePropertyContainer()
        {
            ExchangeRunspaceConfigurationSettings.ExchangeApplication clientApplication = this.ClientApplication;
            if (this.IsInnerRunspaceThrottlingEnabled && base.ExchangeRunspaceConfig != null && clientApplication == ExchangeRunspaceConfigurationSettings.ExchangeApplication.Unknown)
            {
                clientApplication = base.ExchangeRunspaceConfig.ConfigurationSettings.ClientApplication;
            }
            ADServerSettings adServerSettingsOverride = null;

            base.CurrentTaskContext.TryGetItem <ADServerSettings>("CmdletServerSettings", ref adServerSettingsOverride);
            ExchangePropertyContainer.PropagateExchangePropertyContainer(base.SessionState, this.monadConnection.RunspaceProxy, this.IsInnerRunspaceRBACEnabled, this.IsInnerRunspaceThrottlingEnabled, adServerSettingsOverride, clientApplication);
        }
Example #6
0
        // Token: 0x06001674 RID: 5748 RVA: 0x00054FE0 File Offset: 0x000531E0
        private void TryFailOver()
        {
            ADDriverContext  threadADContext  = ADSessionSettings.GetThreadADContext();
            ADServerSettings adserverSettings = (threadADContext != null) ? threadADContext.ServerSettings : null;

            if (adserverSettings != null && adserverSettings.IsFailoverRequired())
            {
                ADServerSettings newServerSettings;
                string           str;
                if (adserverSettings.TryFailover(out newServerSettings, out str, false))
                {
                    this.PersistNewServerSettings(newServerSettings);
                    return;
                }
                CmdletLogger.SafeAppendGenericInfo(this.context.UniqueId, "ADServerSettings-TryFailOver", "Failed - " + str);
            }
        }
Example #7
0
        internal static void LogADServerSettings(Guid cmdletUniqueId, ADServerSettings serverSettings)
        {
            if (serverSettings == null)
            {
                CmdletLogger.SafeAppendGenericInfo(cmdletUniqueId, "ADServerSettings", "null");
                return;
            }
            CmdletLogger.SafeSetLogger(cmdletUniqueId, RpsCmdletMetadata.ADViewEntireForest, serverSettings.ViewEntireForest);
            if (serverSettings.RecipientViewRoot != null)
            {
                CmdletLogger.SafeSetLogger(cmdletUniqueId, RpsCmdletMetadata.ADRecipientViewRoot, serverSettings.RecipientViewRoot.ToCanonicalName());
            }
            if (serverSettings.ConfigurationDomainControllers != null)
            {
                CmdletLogger.SafeSetLogger(cmdletUniqueId, RpsCmdletMetadata.ADConfigurationDomainControllers, string.Join <Fqdn>(",", serverSettings.ConfigurationDomainControllers.Values));
            }
            if (serverSettings.PreferredGlobalCatalogs != null)
            {
                CmdletLogger.SafeSetLogger(cmdletUniqueId, RpsCmdletMetadata.ADPreferredGlobalCatalogs, string.Join <Fqdn>(",", serverSettings.PreferredGlobalCatalogs.Values));
            }
            if (serverSettings.PreferredDomainControllers != null)
            {
                CmdletLogger.SafeSetLogger(cmdletUniqueId, RpsCmdletMetadata.ADPreferredDomainControllers, string.Join <Fqdn>(",", serverSettings.PreferredDomainControllers.ToArray()));
            }
            RunspaceServerSettings runspaceServerSettings = serverSettings as RunspaceServerSettings;

            if (runspaceServerSettings == null)
            {
                CmdletLogger.SafeAppendGenericInfo(cmdletUniqueId, "RunspaceServerSettings", "null");
                return;
            }
            if (runspaceServerSettings.UserConfigurationDomainController != null)
            {
                CmdletLogger.SafeSetLogger(cmdletUniqueId, RpsCmdletMetadata.ADUserConfigurationDomainController, runspaceServerSettings.UserConfigurationDomainController);
            }
            if (runspaceServerSettings.UserPreferredGlobalCatalog != null)
            {
                CmdletLogger.SafeSetLogger(cmdletUniqueId, RpsCmdletMetadata.ADUserPreferredGlobalCatalog, runspaceServerSettings.UserConfigurationDomainController);
            }
            if (runspaceServerSettings.UserPreferredDomainControllers != null)
            {
                CmdletLogger.SafeSetLogger(cmdletUniqueId, RpsCmdletMetadata.ADUserPreferredDomainControllers, string.Join <Fqdn>(",", runspaceServerSettings.UserPreferredDomainControllers.ToArray()));
            }
        }
Example #8
0
        protected override ADServerSettings GetCmdletADServerSettings()
        {
            this.fields = base.CurrentTaskContext.InvocationInfo.Fields;
            SwitchParameter switchParameter = this.fields.Contains("IsDatacenter") ? ((SwitchParameter)this.fields["IsDatacenter"]) : new SwitchParameter(false);

            if (!this.fields.Contains(ManageOrganizationTaskBase.ParameterCreateSharedConfig))
            {
                new SwitchParameter(false);
            }
            else
            {
                SwitchParameter switchParameter2 = (SwitchParameter)this.fields[ManageOrganizationTaskBase.ParameterCreateSharedConfig];
            }
            string text  = (string)this.fields["TenantProgramId"];
            string text2 = (string)this.fields["TenantOfferId"];
            AccountPartitionIdParameter accountPartitionIdParameter = (AccountPartitionIdParameter)this.fields["AccountPartition"];
            string value = null;

            if (TopologyProvider.CurrentTopologyMode == TopologyMode.ADTopologyService && switchParameter)
            {
                ADServerSettings serverSettings = ExchangePropertyContainer.GetServerSettings(base.CurrentTaskContext.SessionState);
                if (serverSettings != null && accountPartitionIdParameter != null)
                {
                    PartitionId partitionId = RecipientTaskHelper.ResolvePartitionId(accountPartitionIdParameter, null);
                    if (partitionId != null)
                    {
                        value = serverSettings.PreferredGlobalCatalog(partitionId.ForestFQDN);
                    }
                }
                if (string.IsNullOrEmpty(value) && this.Name != null)
                {
                    if (this.domainBasedADServerSettings == null)
                    {
                        PartitionId partitionId2 = (accountPartitionIdParameter == null) ? PartitionId.LocalForest : RecipientTaskHelper.ResolvePartitionId(accountPartitionIdParameter, null);
                        this.domainBasedADServerSettings = RunspaceServerSettings.CreateGcOnlyRunspaceServerSettings(this.Name.ToLowerInvariant(), partitionId2.ForestFQDN, false);
                    }
                    return(this.domainBasedADServerSettings);
                }
            }
            return(base.GetCmdletADServerSettings());
        }
Example #9
0
        protected override ADServerSettings GetCmdletADServerSettings()
        {
            PropertyBag             fields                  = base.CurrentTaskContext.InvocationInfo.Fields;
            SwitchParameter         switchParameter         = fields.Contains("IsDatacenter") ? ((SwitchParameter)fields["IsDatacenter"]) : new SwitchParameter(false);
            bool                    flag                    = fields.Contains("DomainController");
            OrganizationIdParameter organizationIdParameter = (OrganizationIdParameter)fields["PrimaryOrganization"];
            PartitionId             partitionId             = (organizationIdParameter != null) ? ADAccountPartitionLocator.GetPartitionIdByAcceptedDomainName(organizationIdParameter.RawIdentity) : null;
            string                  value                   = null;
            ADServerSettings        serverSettings          = ExchangePropertyContainer.GetServerSettings(base.CurrentTaskContext.SessionState);

            if (serverSettings != null && partitionId != null)
            {
                value = serverSettings.PreferredGlobalCatalog(partitionId.ForestFQDN);
            }
            if (switchParameter && organizationIdParameter != null && string.IsNullOrEmpty(value) && partitionId != null && !flag)
            {
                if (this.domainBasedADServerSettings == null)
                {
                    this.domainBasedADServerSettings = RunspaceServerSettings.CreateGcOnlyRunspaceServerSettings(organizationIdParameter.RawIdentity.ToLowerInvariant(), partitionId.ForestFQDN, false);
                }
                return(this.domainBasedADServerSettings);
            }
            return(base.GetCmdletADServerSettings());
        }
Example #10
0
        public static LocalizedString GetADServerSettings(string cmdletName, ADServerSettings serverSettings, CultureInfo targetCulture)
        {
            if (serverSettings == null)
            {
                throw new ArgumentNullException("serverSettings");
            }
            StringBuilder stringBuilder = new StringBuilder();

            if (cmdletName != null)
            {
                stringBuilder.Append(Strings.VerboseAdminSessionSettings(cmdletName).ToString(targetCulture));
                stringBuilder.Append(' ');
            }
            stringBuilder.Append(Strings.VerboseAdminSessionSettingsViewForest(serverSettings.ViewEntireForest.ToString()).ToString(targetCulture));
            stringBuilder.Append(", ");
            if (serverSettings.RecipientViewRoot != null)
            {
                stringBuilder.Append(Strings.VerboseAdminSessionSettingsDefaultScope(serverSettings.RecipientViewRoot.ToCanonicalName()).ToString(targetCulture));
                stringBuilder.Append(", ");
            }
            IDictionary <string, Fqdn> configurationDomainControllers = serverSettings.ConfigurationDomainControllers;

            if (configurationDomainControllers.Count > 0)
            {
                stringBuilder.Append(Strings.VerboseAdminSessionSettingsConfigDC(string.Join <Fqdn>(", ", configurationDomainControllers.Values)).ToString(targetCulture));
                stringBuilder.Append(", ");
            }
            IDictionary <string, Fqdn> preferredGlobalCatalogs = serverSettings.PreferredGlobalCatalogs;

            if (preferredGlobalCatalogs.Count > 0)
            {
                stringBuilder.Append(Strings.VerboseAdminSessionSettingsGlobalCatalog(string.Join <Fqdn>(", ", preferredGlobalCatalogs.Values)).ToString(targetCulture));
                stringBuilder.Append(", ");
            }
            MultiValuedProperty <Fqdn> preferredDomainControllers = serverSettings.PreferredDomainControllers;

            if (preferredDomainControllers != null && preferredDomainControllers.Count > 0)
            {
                StringBuilder stringBuilder2 = new StringBuilder("{ ");
                for (int i = 0; i < preferredDomainControllers.Count; i++)
                {
                    stringBuilder2.Append(preferredDomainControllers[i].ToString());
                    if (i + 1 < preferredDomainControllers.Count)
                    {
                        stringBuilder2.Append(", ");
                    }
                }
                stringBuilder2.Append(" }");
                stringBuilder.Append(Strings.VerboseAdminSessionSettingsDCs(stringBuilder2.ToString()).ToString(targetCulture));
            }
            RunspaceServerSettings runspaceServerSettings = serverSettings as RunspaceServerSettings;

            if (runspaceServerSettings != null)
            {
                if (runspaceServerSettings.UserConfigurationDomainController != null)
                {
                    stringBuilder.Append(", ");
                    stringBuilder.Append(Strings.VerboseAdminSessionSettingsUserConfigDC(runspaceServerSettings.UserConfigurationDomainController).ToString(targetCulture));
                }
                if (runspaceServerSettings.UserPreferredGlobalCatalog != null)
                {
                    stringBuilder.Append(", ");
                    stringBuilder.Append(Strings.VerboseAdminSessionSettingsUserGlobalCatalog(runspaceServerSettings.UserPreferredGlobalCatalog).ToString(targetCulture));
                }
                MultiValuedProperty <Fqdn> userPreferredDomainControllers = runspaceServerSettings.UserPreferredDomainControllers;
                if (userPreferredDomainControllers != null && userPreferredDomainControllers.Count > 0)
                {
                    stringBuilder.Append(", ");
                    StringBuilder stringBuilder3 = new StringBuilder("{ ");
                    for (int j = 0; j < userPreferredDomainControllers.Count; j++)
                    {
                        stringBuilder3.Append(userPreferredDomainControllers[j].ToString());
                        if (j + 1 < userPreferredDomainControllers.Count)
                        {
                            stringBuilder3.Append(", ");
                        }
                    }
                    stringBuilder3.Append(" }");
                    stringBuilder.Append(Strings.VerboseAdminSessionSettingsDCs(stringBuilder3.ToString()).ToString(targetCulture));
                }
            }
            return(new LocalizedString(stringBuilder.ToString()));
        }
Example #11
0
 public static LocalizedString GetADServerSettings(string cmdletName, ADServerSettings serverSettings)
 {
     return(TaskVerboseStringHelper.GetADServerSettings(cmdletName, serverSettings, null));
 }
Example #12
0
 public static LocalizedString GetADServerSettings(ADServerSettings serverSettings)
 {
     return(TaskVerboseStringHelper.GetADServerSettings(null, serverSettings));
 }
 protected override void InternalProcessRecord()
 {
     TaskLogger.LogEnter();
     try
     {
         if (base.ParameterSetName.Equals("Identity"))
         {
             TIdentity identity = this.Identity;
             if (identity.OrganizationId != null)
             {
                 IDirectorySession dataSession = this.recipSession;
                 TIdentity         identity2   = this.Identity;
                 if (TaskHelper.ShouldUnderscopeDataSessionToOrganization(dataSession, identity2.OrganizationId))
                 {
                     IDirectorySession session   = this.recipSession;
                     TIdentity         identity3 = this.Identity;
                     this.recipSession = (IRecipientSession)TaskHelper.UnderscopeSessionToOrganization(session, identity3.OrganizationId, true);
                 }
                 IDirectorySession dataSession2 = this.currentOrgConfigSession;
                 TIdentity         identity4    = this.Identity;
                 if (TaskHelper.ShouldUnderscopeDataSessionToOrganization(dataSession2, identity4.OrganizationId))
                 {
                     IDirectorySession session2  = this.currentOrgConfigSession;
                     TIdentity         identity5 = this.Identity;
                     this.currentOrgConfigSession = (ITenantConfigurationSession)TaskHelper.UnderscopeSessionToOrganization(session2, identity5.OrganizationId, true);
                     this.rjProvider.IndexProvider.ConfigSession = this.currentOrgConfigSession;
                 }
             }
             ADUser    aduser    = null;
             TIdentity identity6 = this.Identity;
             if (!string.IsNullOrEmpty(identity6.MailboxName))
             {
                 IRecipientSession dataSession3         = this.recipSession;
                 IRecipientSession globalCatalogSession = this.gcSession;
                 ADServerSettings  serverSettings       = base.ServerSettings;
                 TIdentity         identity7            = this.Identity;
                 aduser = RequestTaskHelper.ResolveADUser(dataSession3, globalCatalogSession, serverSettings, new MailboxOrMailUserIdParameter(identity7.MailboxName), base.OptionalIdentityData, this.DomainController, new DataAccessHelper.CategorizedGetDataObjectDelegate(base.GetDataObject <ADUser>), new Task.TaskVerboseLoggingDelegate(base.WriteVerbose), new Task.ErrorLoggerDelegate(base.WriteError), false);
                 if (aduser != null)
                 {
                     TIdentity identity8 = this.Identity;
                     identity8.MailboxId = aduser.Id;
                     if (TaskHelper.ShouldUnderscopeDataSessionToOrganization(this.recipSession, aduser))
                     {
                         this.recipSession = (IRecipientSession)TaskHelper.UnderscopeSessionToOrganization(this.recipSession, aduser.OrganizationId, true);
                     }
                     if (TaskHelper.ShouldUnderscopeDataSessionToOrganization(this.currentOrgConfigSession, aduser))
                     {
                         this.currentOrgConfigSession = (ITenantConfigurationSession)TaskHelper.UnderscopeSessionToOrganization(this.currentOrgConfigSession, aduser.OrganizationId, true);
                         this.rjProvider.IndexProvider.ConfigSession = this.currentOrgConfigSession;
                     }
                 }
             }
             TIdentity identity9 = this.Identity;
             if (!string.IsNullOrEmpty(identity9.OrganizationName))
             {
                 IConfigurationSession configurationSession = RequestTaskHelper.CreateOrganizationFindingSession(base.CurrentOrganizationId, base.ExecutingUserOrganizationId);
                 TIdentity             identity10           = this.Identity;
                 IIdentityParameter    id                  = new OrganizationIdParameter(identity10.OrganizationName);
                 IConfigDataProvider   session3            = configurationSession;
                 ObjectId             rootID               = null;
                 TIdentity            identity11           = this.Identity;
                 LocalizedString?     notFoundError        = new LocalizedString?(Strings.ErrorOrganizationNotFound(identity11.OrganizationName));
                 TIdentity            identity12           = this.Identity;
                 ADOrganizationalUnit adorganizationalUnit = (ADOrganizationalUnit)base.GetDataObject <ADOrganizationalUnit>(id, session3, rootID, notFoundError, new LocalizedString?(Strings.ErrorOrganizationNotUnique(identity12.OrganizationName)));
                 if (TaskHelper.ShouldUnderscopeDataSessionToOrganization(this.recipSession, adorganizationalUnit))
                 {
                     this.recipSession = (IRecipientSession)TaskHelper.UnderscopeSessionToOrganization(this.recipSession, adorganizationalUnit.OrganizationId, true);
                 }
                 if (TaskHelper.ShouldUnderscopeDataSessionToOrganization(this.currentOrgConfigSession, adorganizationalUnit))
                 {
                     this.currentOrgConfigSession = (ITenantConfigurationSession)TaskHelper.UnderscopeSessionToOrganization(this.currentOrgConfigSession, adorganizationalUnit.OrganizationId, true);
                     this.rjProvider.IndexProvider.ConfigSession = this.currentOrgConfigSession;
                 }
             }
             TIdentity identity13 = this.Identity;
             identity13.SetDefaultIndex(this.DefaultRequestIndexId);
             IRequestIndexEntry entry        = this.GetEntry();
             RequestJobObjectId requestJobId = entry.GetRequestJobId();
             if (entry.TargetUserId != null)
             {
                 if (aduser != null && aduser.Id.Equals(entry.TargetUserId))
                 {
                     requestJobId.TargetUser = aduser;
                 }
                 else
                 {
                     requestJobId.TargetUser = RequestTaskHelper.ResolveADUser(this.recipSession, this.gcSession, base.ServerSettings, new MailboxOrMailUserIdParameter(entry.TargetUserId), base.OptionalIdentityData, this.DomainController, new DataAccessHelper.CategorizedGetDataObjectDelegate(base.GetDataObject <ADUser>), new Task.TaskVerboseLoggingDelegate(base.WriteVerbose), new Task.ErrorLoggerDelegate(base.WriteError), false);
                 }
             }
             if (entry.SourceUserId != null)
             {
                 if (aduser != null && aduser.Id.Equals(entry.SourceUserId))
                 {
                     requestJobId.SourceUser = aduser;
                 }
                 else
                 {
                     requestJobId.SourceUser = RequestTaskHelper.ResolveADUser(this.recipSession, this.gcSession, base.ServerSettings, new MailboxOrMailUserIdParameter(entry.SourceUserId), base.OptionalIdentityData, this.DomainController, new DataAccessHelper.CategorizedGetDataObjectDelegate(base.GetDataObject <ADUser>), new Task.TaskVerboseLoggingDelegate(base.WriteVerbose), new Task.ErrorLoggerDelegate(base.WriteError), false);
                 }
             }
             this.CheckIndexEntry(entry);
             TDataObject tdataObject = (TDataObject)((object)this.rjProvider.Read <TDataObject>(requestJobId));
             if (tdataObject == null || tdataObject.Status == RequestStatus.None)
             {
                 TIdentity identity14 = this.Identity;
                 base.WriteError(new ManagementObjectNotFoundException(Strings.ErrorCouldNotFindRequest(identity14.ToString())), ErrorCategory.InvalidArgument, this.Identity);
             }
             else if (tdataObject.RequestType != this.RequestType)
             {
                 base.WriteError(new ManagementObjectNotFoundException(Strings.ErrorNotEnoughInformationToFindRequest), ErrorCategory.InvalidArgument, this.Identity);
             }
             else
             {
                 this.WriteResult(tdataObject);
             }
         }
         else if (base.ParameterSetName.Equals("MigrationRequestQueue"))
         {
             if (this.RequestQueue != null)
             {
                 MailboxDatabase mailboxDatabase = (MailboxDatabase)base.GetDataObject <MailboxDatabase>(this.RequestQueue, this.configSession, null, new LocalizedString?(Strings.ErrorMailboxDatabaseNotFound(this.RequestQueue.ToString())), new LocalizedString?(Strings.ErrorMailboxDatabaseNotUnique(this.RequestQueue.ToString())));
                 this.fromMdb = mailboxDatabase.Id;
             }
             this.rjProvider.AllowInvalid = true;
             base.InternalProcessRecord();
         }
     }
     finally
     {
         TaskLogger.LogExit();
     }
 }
Example #14
0
        internal static void PropagateExchangePropertyContainer(ISessionState sessionState, RunspaceProxy runspace, bool propagateRBAC, bool propagateBudget, ADServerSettings adServerSettingsOverride, ExchangeRunspaceConfigurationSettings.ExchangeApplication application)
        {
            ExchangePropertyContainer propertyContainer         = ExchangePropertyContainer.GetPropertyContainer(sessionState);
            ExchangePropertyContainer exchangePropertyContainer = new ExchangePropertyContainer();

            if (propertyContainer.exchangeRunspaceConfiguration != null)
            {
                propertyContainer.exchangeRunspaceConfiguration.TryGetExecutingUserId(out exchangePropertyContainer.executingUserId);
                exchangePropertyContainer.executingUserOrganizationId = propertyContainer.exchangeRunspaceConfiguration.OrganizationId;
                if (propagateRBAC)
                {
                    exchangePropertyContainer.exchangeRunspaceConfiguration = propertyContainer.exchangeRunspaceConfiguration;
                }
                exchangePropertyContainer.propagatedClientAppId = application;
                if (propertyContainer.budget != null && propagateBudget)
                {
                    exchangePropertyContainer.budget = ExchangePropertyContainer.AcquirePowerShellBudget(propertyContainer.exchangeRunspaceConfiguration);
                }
            }
            else
            {
                exchangePropertyContainer.executingUserId             = propertyContainer.executingUserId;
                exchangePropertyContainer.executingUserOrganizationId = propertyContainer.executingUserOrganizationId;
            }
            exchangePropertyContainer.logEntries = propertyContainer.logEntries;
            exchangePropertyContainer.logEnabled = propertyContainer.logEnabled;
            if (adServerSettingsOverride == null)
            {
                exchangePropertyContainer.serverSettings = propertyContainer.serverSettings;
            }
            else
            {
                exchangePropertyContainer.serverSettings = adServerSettingsOverride;
            }
            runspace.SetVariable(ExchangePropertyContainer.ExchangePropertyContainerName, exchangePropertyContainer);
        }
Example #15
0
        protected override IConfigurable PrepareDataObject()
        {
            TIdentity identity = this.Identity;

            if (identity.OrganizationId != null)
            {
                IDirectorySession writeableSession = this.WriteableSession;
                TIdentity         identity2        = this.Identity;
                if (TaskHelper.ShouldUnderscopeDataSessionToOrganization(writeableSession, identity2.OrganizationId))
                {
                    IDirectorySession writeableSession2 = this.WriteableSession;
                    TIdentity         identity3         = this.Identity;
                    this.WriteableSession = (IRecipientSession)TaskHelper.UnderscopeSessionToOrganization(writeableSession2, identity3.OrganizationId, true);
                }
                IDirectorySession currentOrgConfigSession = this.CurrentOrgConfigSession;
                TIdentity         identity4 = this.Identity;
                if (TaskHelper.ShouldUnderscopeDataSessionToOrganization(currentOrgConfigSession, identity4.OrganizationId))
                {
                    IDirectorySession currentOrgConfigSession2 = this.CurrentOrgConfigSession;
                    TIdentity         identity5 = this.Identity;
                    this.CurrentOrgConfigSession = (ITenantConfigurationSession)TaskHelper.UnderscopeSessionToOrganization(currentOrgConfigSession2, identity5.OrganizationId, true);
                    this.RJProvider.IndexProvider.ConfigSession = this.CurrentOrgConfigSession;
                }
            }
            TIdentity identity6 = this.Identity;

            if (!string.IsNullOrEmpty(identity6.MailboxName))
            {
                IRecipientSession writeableSession3 = this.WriteableSession;
                IRecipientSession gcsession         = this.GCSession;
                ADServerSettings  serverSettings    = base.ServerSettings;
                TIdentity         identity7         = this.Identity;
                ADUser            aduser            = RequestTaskHelper.ResolveADUser(writeableSession3, gcsession, serverSettings, new UserIdParameter(identity7.MailboxName), base.OptionalIdentityData, this.DomainController, new DataAccessHelper.CategorizedGetDataObjectDelegate(base.GetDataObject <ADUser>), new Task.TaskVerboseLoggingDelegate(base.WriteVerbose), new Task.ErrorLoggerDelegate(base.WriteError), true);
                if (aduser != null)
                {
                    TIdentity identity8 = this.Identity;
                    identity8.MailboxId = aduser.Id;
                    if (TaskHelper.ShouldUnderscopeDataSessionToOrganization(this.WriteableSession, aduser))
                    {
                        this.WriteableSession = (IRecipientSession)TaskHelper.UnderscopeSessionToOrganization(this.WriteableSession, aduser.OrganizationId, true);
                    }
                    if (TaskHelper.ShouldUnderscopeDataSessionToOrganization(this.CurrentOrgConfigSession, aduser))
                    {
                        this.CurrentOrgConfigSession = (ITenantConfigurationSession)TaskHelper.UnderscopeSessionToOrganization(this.CurrentOrgConfigSession, aduser.OrganizationId, true);
                        this.RJProvider.IndexProvider.ConfigSession = this.CurrentOrgConfigSession;
                    }
                }
            }
            TIdentity identity9 = this.Identity;

            if (!string.IsNullOrEmpty(identity9.OrganizationName))
            {
                IConfigurationSession configurationSession = RequestTaskHelper.CreateOrganizationFindingSession(base.CurrentOrganizationId, base.ExecutingUserOrganizationId);
                TIdentity             identity10           = this.Identity;
                IIdentityParameter    id                  = new OrganizationIdParameter(identity10.OrganizationName);
                IConfigDataProvider   session             = configurationSession;
                ObjectId             rootID               = null;
                TIdentity            identity11           = this.Identity;
                LocalizedString?     notFoundError        = new LocalizedString?(Strings.ErrorOrganizationNotFound(identity11.OrganizationName));
                TIdentity            identity12           = this.Identity;
                ADOrganizationalUnit adorganizationalUnit = (ADOrganizationalUnit)base.GetDataObject <ADOrganizationalUnit>(id, session, rootID, notFoundError, new LocalizedString?(Strings.ErrorOrganizationNotUnique(identity12.OrganizationName)));
                if (TaskHelper.ShouldUnderscopeDataSessionToOrganization(this.WriteableSession, adorganizationalUnit))
                {
                    this.WriteableSession = (IRecipientSession)TaskHelper.UnderscopeSessionToOrganization(this.WriteableSession, adorganizationalUnit.OrganizationId, true);
                }
                if (TaskHelper.ShouldUnderscopeDataSessionToOrganization(this.CurrentOrgConfigSession, adorganizationalUnit))
                {
                    this.CurrentOrgConfigSession = (ITenantConfigurationSession)TaskHelper.UnderscopeSessionToOrganization(this.CurrentOrgConfigSession, adorganizationalUnit.OrganizationId, true);
                    this.RJProvider.IndexProvider.ConfigSession = this.CurrentOrgConfigSession;
                }
            }
            TIdentity identity13 = this.Identity;

            identity13.SetDefaultIndex(this.DefaultRequestIndexId);
            this.IndexEntry = this.GetEntry();
            this.CheckIndexEntry();
            if (this.IndexEntry == null)
            {
                return(null);
            }
            RequestJobObjectId requestJobId = this.IndexEntry.GetRequestJobId();

            if (this.IndexEntry.TargetUserId != null)
            {
                requestJobId.TargetUser = this.ResolveADUser(this.IndexEntry.TargetUserId);
            }
            if (this.IndexEntry.SourceUserId != null)
            {
                requestJobId.SourceUser = this.ResolveADUser(this.IndexEntry.SourceUserId);
            }
            return((TransactionalRequestJob)this.RJProvider.Read <TransactionalRequestJob>(requestJobId));
        }
Example #16
0
 protected override void InternalProcessRecord()
 {
     TaskLogger.LogEnter();
     try
     {
         if (this.Identity != null)
         {
             TIdentity identity = this.Identity;
             if (identity.OrganizationId != null)
             {
                 IDirectorySession recipSession = this.RecipSession;
                 TIdentity         identity2    = this.Identity;
                 if (TaskHelper.ShouldUnderscopeDataSessionToOrganization(recipSession, identity2.OrganizationId))
                 {
                     IDirectorySession recipSession2 = this.RecipSession;
                     TIdentity         identity3     = this.Identity;
                     this.RecipSession = (IRecipientSession)TaskHelper.UnderscopeSessionToOrganization(recipSession2, identity3.OrganizationId, true);
                 }
                 IDirectorySession currentOrgConfigSession = this.CurrentOrgConfigSession;
                 TIdentity         identity4 = this.Identity;
                 if (TaskHelper.ShouldUnderscopeDataSessionToOrganization(currentOrgConfigSession, identity4.OrganizationId))
                 {
                     IDirectorySession currentOrgConfigSession2 = this.CurrentOrgConfigSession;
                     TIdentity         identity5 = this.Identity;
                     this.CurrentOrgConfigSession     = (ITenantConfigurationSession)TaskHelper.UnderscopeSessionToOrganization(currentOrgConfigSession2, identity5.OrganizationId, true);
                     this.indexProvider.ConfigSession = this.CurrentOrgConfigSession;
                 }
             }
             TIdentity identity6 = this.Identity;
             if (!string.IsNullOrEmpty(identity6.MailboxName))
             {
                 IRecipientSession recipSession3  = this.RecipSession;
                 IRecipientSession gcsession      = this.GCSession;
                 ADServerSettings  serverSettings = base.ServerSettings;
                 TIdentity         identity7      = this.Identity;
                 ADUser            aduser         = RequestTaskHelper.ResolveADUser(recipSession3, gcsession, serverSettings, new MailboxOrMailUserIdParameter(identity7.MailboxName), base.OptionalIdentityData, this.DomainController, new DataAccessHelper.CategorizedGetDataObjectDelegate(base.GetDataObject <ADUser>), new Task.TaskVerboseLoggingDelegate(base.WriteVerbose), new Task.ErrorLoggerDelegate(base.WriteError), false);
                 if (aduser != null)
                 {
                     TIdentity identity8 = this.Identity;
                     identity8.MailboxId = aduser.Id;
                     if (TaskHelper.ShouldUnderscopeDataSessionToOrganization(this.RecipSession, aduser))
                     {
                         this.RecipSession = (IRecipientSession)TaskHelper.UnderscopeSessionToOrganization(this.RecipSession, aduser.OrganizationId, true);
                     }
                     if (TaskHelper.ShouldUnderscopeDataSessionToOrganization(this.CurrentOrgConfigSession, aduser))
                     {
                         this.CurrentOrgConfigSession     = (ITenantConfigurationSession)TaskHelper.UnderscopeSessionToOrganization(this.CurrentOrgConfigSession, aduser.OrganizationId, true);
                         this.indexProvider.ConfigSession = this.CurrentOrgConfigSession;
                     }
                 }
             }
             TIdentity identity9 = this.Identity;
             if (!string.IsNullOrEmpty(identity9.OrganizationName))
             {
                 IConfigurationSession configurationSession = RequestTaskHelper.CreateOrganizationFindingSession(base.CurrentOrganizationId, base.ExecutingUserOrganizationId);
                 TIdentity             identity10           = this.Identity;
                 IIdentityParameter    id                  = new OrganizationIdParameter(identity10.OrganizationName);
                 IConfigDataProvider   session             = configurationSession;
                 ObjectId             rootID               = null;
                 TIdentity            identity11           = this.Identity;
                 LocalizedString?     notFoundError        = new LocalizedString?(Strings.ErrorOrganizationNotFound(identity11.OrganizationName));
                 TIdentity            identity12           = this.Identity;
                 ADOrganizationalUnit adorganizationalUnit = (ADOrganizationalUnit)base.GetDataObject <ADOrganizationalUnit>(id, session, rootID, notFoundError, new LocalizedString?(Strings.ErrorOrganizationNotUnique(identity12.OrganizationName)));
                 if (TaskHelper.ShouldUnderscopeDataSessionToOrganization(this.RecipSession, adorganizationalUnit))
                 {
                     this.RecipSession = (IRecipientSession)TaskHelper.UnderscopeSessionToOrganization(this.RecipSession, adorganizationalUnit.OrganizationId, true);
                 }
                 if (TaskHelper.ShouldUnderscopeDataSessionToOrganization(this.CurrentOrgConfigSession, adorganizationalUnit))
                 {
                     this.CurrentOrgConfigSession     = (ITenantConfigurationSession)TaskHelper.UnderscopeSessionToOrganization(this.CurrentOrgConfigSession, adorganizationalUnit.OrganizationId, true);
                     this.indexProvider.ConfigSession = this.CurrentOrgConfigSession;
                 }
             }
             TIdentity identity13 = this.Identity;
             identity13.SetDefaultIndex(this.DefaultRequestIndexId);
         }
         base.InternalProcessRecord();
     }
     finally
     {
         TaskLogger.LogExit();
     }
 }
Example #17
0
        internal static ADObjectId GetRootOrgUsgContainerId(IConfigurationSession configurationSession, ADServerSettings adServerSettings, IRecipientSession globalCatalogSession, OrganizationId organizationId)
        {
            IRecipientSession tenantOrRootOrgRecipientSession = DirectorySessionFactory.Default.GetTenantOrRootOrgRecipientSession(adServerSettings.PreferredGlobalCatalog(globalCatalogSession.SessionSettings.PartitionId.ForestFQDN), true, ConsistencyMode.PartiallyConsistent, null, ADSessionSettings.FromAccountPartitionRootOrgScopeSet(globalCatalogSession.SessionSettings.PartitionId), 110, "GetRootOrgUsgContainerId", "f:\\15.00.1497\\sources\\dev\\Management\\src\\Management\\RBAC\\RoleGroup\\RoleGroupCommon.cs");

            return(RoleGroupCommon.RoleGroupContainerId(tenantOrRootOrgRecipientSession, configurationSession));
        }
Example #18
0
        internal static MailboxData DiscoverTestMailbox(IIdentityParameter identity, IRecipientSession adSession, ADServerSettings serverSettings, DataAccessHelper.CategorizedGetDataObjectDelegate getDataObject, Task.TaskVerboseLoggingDelegate writeVerbose, Task.ErrorLoggerDelegate writeError)
        {
            if (identity == null)
            {
                MigrationADProvider migrationADProvider = new MigrationADProvider(adSession);
                return(migrationADProvider.GetMailboxDataForManagementMailbox());
            }
            ADUser      aduser      = RequestTaskHelper.ResolveADUser(adSession, adSession, serverSettings, identity, null, null, getDataObject, writeVerbose, writeError, true);
            MailboxData mailboxData = new MailboxData(aduser.ExchangeGuid, new Fqdn(aduser.ServerName), aduser.LegacyExchangeDN, aduser.Id, aduser.ExchangeObjectId);

            mailboxData.Update(identity.RawIdentity, aduser.OrganizationId);
            return(mailboxData);
        }
        public static ADUser ResolveADUser(IRecipientSession dataSession, IRecipientSession globalCatalogSession, ADServerSettings serverSettings, IIdentityParameter identity, OptionalIdentityData optionalData, string domainController, DataAccessHelper.CategorizedGetDataObjectDelegate getDataObjectHandler, Task.TaskVerboseLoggingDelegate logHandler, Task.ErrorLoggerDelegate errorHandler, bool checkScopes)
        {
            ADUser           aduser = (ADUser)RecipientTaskHelper.ResolveDataObject <ADUser>(dataSession, globalCatalogSession, serverSettings, identity, null, optionalData, domainController, getDataObjectHandler, logHandler, errorHandler);
            ADScopeException exception;

            if (checkScopes && !dataSession.TryVerifyIsWithinScopes(aduser, true, out exception))
            {
                errorHandler(exception, (ExchangeErrorCategory)5, identity);
            }
            return(aduser);
        }
Example #20
0
 // Token: 0x060006F2 RID: 1778 RVA: 0x00019D68 File Offset: 0x00017F68
 internal static bool ShouldPassDomainControllerToSession(string domainController, ADSessionSettings sessionSettings)
 {
     return(string.IsNullOrEmpty(domainController) || !VariantConfiguration.InvariantNoFlightingSnapshot.Global.MultiTenancy.Enabled || ADServerSettings.IsServerNamePartitionSameAsPartitionId(domainController, sessionSettings.CurrentOrganizationId.PartitionId.ForestFQDN));
 }
Example #21
0
        private void InitializeRunspaceServerSettings(object sender, EventArgs e)
        {
            ISessionState    sessionState     = this.CurrentTaskContext.SessionState;
            ADServerSettings adserverSettings = null;
            bool             flag             = false;
            bool             flag2            = false;
            string           value            = null;

            if (sessionState != null)
            {
                flag2 = ExchangePropertyContainer.IsContainerInitialized(sessionState);
                if (flag2)
                {
                    adserverSettings = ExchangePropertyContainer.GetServerSettings(sessionState);
                    if (adserverSettings != null)
                    {
                        value = "SessionState";
                    }
                }
            }
            if (adserverSettings == null)
            {
                adserverSettings = ADSessionSettings.GetProcessServerSettings();
                if (adserverSettings != null)
                {
                    value = "ProcessServerSettings";
                }
            }
            if (adserverSettings == null)
            {
                if (this.CurrentTaskContext.CommandShell != null)
                {
                    this.CurrentTaskContext.CommandShell.TryGetVariableValue <ADServerSettings>(ExchangePropertyContainer.ADServerSettingsVarName, out adserverSettings);
                }
                flag = (adserverSettings != null);
                if (adserverSettings != null)
                {
                    value = "CommandShell";
                }
            }
            if (TopologyProvider.CurrentTopologyMode == TopologyMode.ADTopologyService)
            {
                ADServerSettings cmdletADServerSettings = this.GetCmdletADServerSettings();
                if (cmdletADServerSettings != null)
                {
                    this.CurrentTaskContext.Items["CmdletServerSettings"] = cmdletADServerSettings;
                    value            = "ADTopologyService";
                    adserverSettings = cmdletADServerSettings;
                }
            }
            if (adserverSettings == null)
            {
                flag = true;
                if (TopologyProvider.CurrentTopologyMode == TopologyMode.Adam)
                {
                    if (this.CurrentTaskContext.InvocationInfo != null && this.CurrentTaskContext.InvocationInfo.IsVerboseOn)
                    {
                        this.CurrentTaskContext.CommandShell.WriteVerbose(Strings.VerboseInitializeRunspaceServerSettingsAdam);
                    }
                    if (Globals.InstanceType == InstanceType.NotInitialized)
                    {
                        Globals.InitializeSinglePerfCounterInstance();
                    }
                    value            = "Adam-SimpleServerSettings";
                    adserverSettings = new SimpleServerSettings();
                }
                else if (TopologyProvider.CurrentTopologyMode == TopologyMode.Ldap)
                {
                    if (this.CurrentTaskContext.InvocationInfo != null && this.CurrentTaskContext.CommandShell != null && this.CurrentTaskContext.InvocationInfo.IsVerboseOn)
                    {
                        this.CurrentTaskContext.CommandShell.WriteVerbose(Strings.VerboseInitializeRunspaceServerSettingsLocal);
                    }
                    Globals.InitializeMultiPerfCounterInstance("EMS");
                    value            = "Ldap-LocalCmdLineServerSettings";
                    adserverSettings = LocalCmdLineServerSettings.CreateLocalCmdLineServerSettings();
                }
                else
                {
                    if (this.CurrentTaskContext.InvocationInfo != null && this.CurrentTaskContext.InvocationInfo.IsVerboseOn)
                    {
                        this.CurrentTaskContext.CommandShell.WriteVerbose(Strings.VerboseInitializeRunspaceServerSettingsRemote);
                    }
                    adserverSettings = this.CreateADServerSettingsForOrganization(false);
                    if (adserverSettings == null)
                    {
                        value            = "GCRandomly";
                        adserverSettings = RunspaceServerSettings.CreateRunspaceServerSettings(false);
                    }
                }
            }
            if (flag)
            {
                if (flag2)
                {
                    ExchangePropertyContainer.SetServerSettings(sessionState, adserverSettings);
                }
                else
                {
                    sessionState.Variables[ExchangePropertyContainer.ADServerSettingsVarName] = adserverSettings;
                }
            }
            ADSessionSettings.SetThreadADContext(new ADDriverContext(adserverSettings, ContextMode.Cmdlet));
            LocalizedString localizedString = LocalizedString.Empty;

            if (this.CurrentTaskContext.InvocationInfo != null)
            {
                localizedString = TaskVerboseStringHelper.GetADServerSettings(this.CurrentTaskContext.InvocationInfo.CommandName, adserverSettings);
                if (this.CurrentTaskContext.InvocationInfo.IsVerboseOn && !string.Equals(this.CurrentTaskContext.InvocationInfo.CommandName, "Write-ExchangeSetupLog", StringComparison.OrdinalIgnoreCase) && this.CurrentTaskContext.CommandShell != null)
                {
                    this.CurrentTaskContext.CommandShell.WriteVerbose(localizedString);
                }
            }
            CmdletLogger.SafeSetLogger(this.CurrentTaskContext.UniqueId, RpsCmdletMetadata.RunspaceSettingsCreationHint, value);
            CmdletLogHelper.LogADServerSettings(this.CurrentTaskContext.UniqueId, adserverSettings);
            if (ExTraceGlobals.LogTracer.IsTraceEnabled(TraceType.InfoTrace))
            {
                ExTraceGlobals.LogTracer.Information <LocalizedString>(0L, "Cmdlet ADServerSettings {0}", localizedString);
            }
        }
Example #22
0
        internal static ADUser ResolvePartitionMailbox(MailboxIdParameter partitionMailboxIdentity, IRecipientSession tenantGlobalCatalogSession, ADServerSettings serverSettings, DataAccessHelper.CategorizedGetDataObjectDelegate getDataObject, Task.ErrorLoggerDelegate writeError, bool datacenterFirstOrg)
        {
            ADUser aduser;

            if (partitionMailboxIdentity != null)
            {
                ADObjectId rootID = null;
                if (datacenterFirstOrg)
                {
                    rootID = ADSystemConfigurationSession.GetFirstOrgUsersContainerId();
                }
                aduser = (ADUser)getDataObject(partitionMailboxIdentity, tenantGlobalCatalogSession, rootID, null, new LocalizedString?(Strings.MigrationPartitionMailboxNotFound), new LocalizedString?(Strings.MigrationPartitionMailboxAmbiguous), ExchangeErrorCategory.Client);
                if (!aduser.PersistedCapabilities.Contains(Capability.OrganizationCapabilityMigration))
                {
                    writeError(new MigrationPartitionMailboxInvalidException(aduser.Alias), ExchangeErrorCategory.Client, partitionMailboxIdentity);
                }
            }
            else
            {
                List <ADUser> organizationMailboxesByCapability = OrganizationMailbox.GetOrganizationMailboxesByCapability(tenantGlobalCatalogSession, OrganizationCapability.Migration);
                if (organizationMailboxesByCapability == null || organizationMailboxesByCapability.Count == 0)
                {
                    organizationMailboxesByCapability = OrganizationMailbox.GetOrganizationMailboxesByCapability(tenantGlobalCatalogSession, OrganizationCapability.Management);
                }
                if (organizationMailboxesByCapability == null || organizationMailboxesByCapability.Count == 0)
                {
                    writeError(new MigrationPartitionMailboxNotFoundException(), ExchangeErrorCategory.Client, null);
                }
                else if (organizationMailboxesByCapability.Count > 1)
                {
                    writeError(new MigrationPartitionMailboxAmbiguousException(), ExchangeErrorCategory.Client, null);
                }
                aduser = organizationMailboxesByCapability[0];
            }
            if (aduser.RecipientTypeDetails != RecipientTypeDetails.ArbitrationMailbox || aduser.Database == null)
            {
                writeError(new MigrationPartitionMailboxInvalidException(aduser.Alias), ExchangeErrorCategory.Client, partitionMailboxIdentity);
            }
            return(aduser);
        }
Example #23
0
        internal static MailboxData DiscoverPublicFolderTestMailbox(IIdentityParameter identity, IConfigurationSession configurationSession, IRecipientSession recipientSession, ADServerSettings serverSettings, DataAccessHelper.CategorizedGetDataObjectDelegate getDataObject, Task.TaskVerboseLoggingDelegate writeVerbose, Task.ErrorLoggerDelegate writeError)
        {
            if (identity == null)
            {
                Organization orgContainer = configurationSession.GetOrgContainer();
                if (orgContainer.DefaultPublicFolderMailbox.HierarchyMailboxGuid != default(Guid))
                {
                    identity = new MailboxIdParameter(orgContainer.DefaultPublicFolderMailbox.HierarchyMailboxGuid.ToString());
                }
                else
                {
                    writeError(new MigrationPermanentException(Strings.ErrorUnableToFindValidPublicFolderMailbox), ExchangeErrorCategory.Client, null);
                }
            }
            ADUser aduser = RequestTaskHelper.ResolveADUser(recipientSession, recipientSession, serverSettings, identity, new OptionalIdentityData(), null, getDataObject, writeVerbose, writeError, true);

            if (aduser.RecipientTypeDetails != RecipientTypeDetails.PublicFolderMailbox)
            {
                writeError(new MigrationPermanentException(Strings.ErrorNotPublicFolderMailbox(identity.RawIdentity)), ExchangeErrorCategory.Client, null);
            }
            return(MailboxData.CreateFromADUser(aduser));
        }
Example #24
0
        internal static void LogADServerSettingsAfterCmdExecuted(Guid cmdletUniqueId, ADServerSettings serverSettings)
        {
            string        key           = "ADServerSettingsInEnd";
            StringBuilder stringBuilder = new StringBuilder();
            string        format        = "{0}:{1} ";

            if (serverSettings == null)
            {
                CmdletLogger.SafeAppendGenericInfo(cmdletUniqueId, key, "null");
                return;
            }
            stringBuilder.AppendFormat(format, RpsCmdletMetadata.ADViewEntireForest.ToString(), serverSettings.ViewEntireForest);
            if (serverSettings.RecipientViewRoot != null)
            {
                stringBuilder.AppendFormat(format, RpsCmdletMetadata.ADRecipientViewRoot.ToString(), serverSettings.RecipientViewRoot.ToCanonicalName());
            }
            if (serverSettings.ConfigurationDomainControllers != null)
            {
                stringBuilder.AppendFormat(format, RpsCmdletMetadata.ADConfigurationDomainControllers, string.Join <Fqdn>(",", serverSettings.ConfigurationDomainControllers.Values));
            }
            if (serverSettings.PreferredGlobalCatalogs != null)
            {
                stringBuilder.AppendFormat(format, RpsCmdletMetadata.ADPreferredGlobalCatalogs.ToString(), string.Join <Fqdn>(",", serverSettings.PreferredGlobalCatalogs.Values));
            }
            if (serverSettings.PreferredDomainControllers != null)
            {
                stringBuilder.AppendFormat(format, RpsCmdletMetadata.ADPreferredDomainControllers.ToString(), string.Join <Fqdn>(",", serverSettings.PreferredDomainControllers.ToArray()));
            }
            RunspaceServerSettings runspaceServerSettings = serverSettings as RunspaceServerSettings;

            if (runspaceServerSettings == null)
            {
                CmdletLogger.SafeAppendGenericInfo(cmdletUniqueId, key, stringBuilder.ToString());
                CmdletLogger.SafeAppendGenericInfo(cmdletUniqueId, "RunspaceServerSettings", "null");
                return;
            }
            if (runspaceServerSettings.UserConfigurationDomainController != null)
            {
                stringBuilder.AppendFormat(format, RpsCmdletMetadata.ADUserConfigurationDomainController.ToString(), runspaceServerSettings.UserConfigurationDomainController);
            }
            if (runspaceServerSettings.UserPreferredGlobalCatalog != null)
            {
                stringBuilder.AppendFormat(format, RpsCmdletMetadata.ADUserPreferredGlobalCatalog.ToString(), runspaceServerSettings.UserConfigurationDomainController);
            }
            if (runspaceServerSettings.UserPreferredDomainControllers != null)
            {
                stringBuilder.AppendFormat(format, RpsCmdletMetadata.ADUserPreferredDomainControllers.ToString(), string.Join <Fqdn>(",", runspaceServerSettings.UserPreferredDomainControllers.ToArray()));
            }
            CmdletLogger.SafeAppendGenericInfo(cmdletUniqueId, key, stringBuilder.ToString());
        }