// 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"); }
internal static void ResetPerOrganizationData(ISessionState sessionState) { ExchangePropertyContainer.SetServerSettings(sessionState, null); ExchangePropertyContainer.RefreshProvisioningBroker(sessionState); }
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); } }