예제 #1
0
 protected override void InternalProcessRecord()
 {
     TaskLogger.LogEnter();
     ADSession.SetAdminTopologyMode();
     if (ExchangePropertyContainer.IsContainerInitialized(base.SessionState))
     {
         ExchangePropertyContainer.SetServerSettings(base.SessionState, null);
     }
     base.SessionState.Variables[ExchangePropertyContainer.ADServerSettingsVarName] = null;
     TaskLogger.LogExit();
 }
예제 #2
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);
        }
예제 #3
0
        // Token: 0x0600102E RID: 4142 RVA: 0x00031540 File Offset: 0x0002F740
        private void CleanUpLocalServerSettings()
        {
            EngineIntrinsics engineIntrinsics = this.RunspaceProxy.GetVariable("ExecutionContext") as EngineIntrinsics;

            if (engineIntrinsics != null)
            {
                ISessionState sessionState = new PSSessionState(engineIntrinsics.SessionState);
                if (ExchangePropertyContainer.IsContainerInitialized(sessionState))
                {
                    ExchangePropertyContainer.SetServerSettings(sessionState, null);
                }
            }
            this.RunspaceProxy.SetVariable(ExchangePropertyContainer.ADServerSettingsVarName, null);
        }
예제 #4
0
        private void InitializeTaskToExecuteInMode(OrganizationId executingUserOrganizationId, ADObjectId executingUserId, string executingUserIdentityName, SmtpAddress executingWindowsLiveId, Task task, string cmdletName, string parameterSet)
        {
            task.CurrentTaskContext.UserInfo = new TaskUserInfo(executingUserOrganizationId, executingUserOrganizationId, executingUserId, executingUserIdentityName, executingWindowsLiveId);
            TaskInvocationInfo taskInvocationInfo = TaskInvocationInfo.CreateForDirectTaskInvocation(cmdletName);

            taskInvocationInfo.IsDebugOn   = false;
            taskInvocationInfo.IsVerboseOn = false;
            if (parameterSet != null)
            {
                taskInvocationInfo.ParameterSetName = parameterSet;
            }
            task.CurrentTaskContext.InvocationInfo = taskInvocationInfo;
            PSLocalSessionState sessionState = new PSLocalSessionState();

            task.CurrentTaskContext.SessionState = sessionState;
            ExchangePropertyContainer.InitExchangePropertyContainer(sessionState, executingUserOrganizationId, executingUserId);
        }
예제 #5
0
 protected override void InternalProcessRecord()
 {
     TaskLogger.LogEnter();
     base.InternalProcessRecord();
     if (!this.settingsNotModifiable)
     {
         bool flag = true;
         RunspaceServerSettings runspaceServerSettings = (RunspaceServerSettings)base.ServerSettings;
         if (runspaceServerSettings != null)
         {
             flag = !runspaceServerSettings.Equals(this.modifiedServerSettings);
         }
         if (flag)
         {
             if (base.IsVerboseOn)
             {
                 base.WriteVerbose(Strings.VerboseSaveADServerSettings);
             }
             ExchangePropertyContainer.SetServerSettings(base.SessionState, this.modifiedServerSettings);
             if (base.IsVerboseOn)
             {
                 base.WriteVerbose(Strings.VerboseSaveADServerSettingsSucceed);
             }
         }
         else
         {
             this.WriteWarning(Strings.WarningADServerSettingsUnchanged);
         }
     }
     if (this.ResetSettings)
     {
         if (ExchangePropertyContainer.IsContainerInitialized(base.SessionState))
         {
             ExchangePropertyContainer.SetServerSettings(base.SessionState, null);
         }
         base.SessionState.Variables[ExchangePropertyContainer.ADServerSettingsVarName] = null;
         if (base.IsVerboseOn)
         {
             base.WriteVerbose(Strings.VerboseResetADServerSettingsSucceed);
         }
     }
     TaskLogger.LogExit();
 }
예제 #6
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());
        }
예제 #7
0
        private static ProvisioningHandler[] GetProvisioningHandlersImpl(Task task)
        {
            if (ProvisioningLayer.Disabled)
            {
                return(null);
            }
            ProvisioningBroker provisioningBroker = ExchangePropertyContainer.GetProvisioningBroker(task.SessionState);

            if (provisioningBroker.InitializationException != null && !task.CurrentTaskContext.InvocationInfo.CommandName.StartsWith("Get-"))
            {
                string commandName;
                if ((commandName = task.CurrentTaskContext.InvocationInfo.CommandName) == null || (!(commandName == "Set-CmdletExtensionAgent") && !(commandName == "Remove-CmdletExtensionAgent") && !(commandName == "Disable-CmdletExtensionAgent")))
                {
                    ProvisioningBrokerException ex = new ProvisioningBrokerException(Strings.ProvisioningBrokerInitializationFailed(provisioningBroker.InitializationException.Message), provisioningBroker.InitializationException);
                    TaskLogger.LogError(ex);
                    throw ex;
                }
                task.WriteWarning(provisioningBroker.InitializationException.Message);
            }
            return(provisioningBroker.GetProvisioningHandlers(task));
        }
예제 #8
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());
        }
예제 #9
0
 internal CmdletLogEntries GetCmdletLogEntries()
 {
     return(ExchangePropertyContainer.GetCmdletLogEntries(base.SessionState));
 }