internal static CmdletLogEntries GetCmdletLogEntries(ISessionState sessionState) { ExchangePropertyContainer propertyContainer = ExchangePropertyContainer.GetPropertyContainer(sessionState); if (propertyContainer == null) { return(null); } return(propertyContainer.logEntries); }
internal static OrganizationId GetExecutingUserOrganizationId(ISessionState sessionState) { ExchangePropertyContainer propertyContainer = ExchangePropertyContainer.GetPropertyContainer(sessionState); if (propertyContainer == null) { return(null); } return(propertyContainer.executingUserOrganizationId); }
internal static ADServerSettings GetServerSettings(ISessionState sessionState) { ExchangePropertyContainer propertyContainer = ExchangePropertyContainer.GetPropertyContainer(sessionState); if (propertyContainer == null) { throw new ArgumentException("sessionState"); } return(propertyContainer.serverSettings); }
internal static ExchangeRunspaceConfigurationSettings.ExchangeApplication GetPropagatedClientAppId(ISessionState sessionState) { ExchangePropertyContainer propertyContainer = ExchangePropertyContainer.GetPropertyContainer(sessionState); if (propertyContainer == null) { return(ExchangeRunspaceConfigurationSettings.ExchangeApplication.Unknown); } return(propertyContainer.propagatedClientAppId); }
internal static IPowerShellBudget GetPowerShellBudget(ISessionState sessionState) { ExchangePropertyContainer propertyContainer = ExchangePropertyContainer.GetPropertyContainer(sessionState); if (propertyContainer == null) { return(null); } return(propertyContainer.budget); }
internal static ExchangeRunspaceConfiguration GetExchangeRunspaceConfiguration(ISessionState sessionState) { ExchangePropertyContainer propertyContainer = ExchangePropertyContainer.GetPropertyContainer(sessionState); if (propertyContainer == null) { return(null); } return(propertyContainer.exchangeRunspaceConfiguration); }
internal static void DisableCmdletLog(ISessionState sessionState) { ADObjectId adobjectId = null; OrganizationId organizationId = null; ExchangePropertyContainer.InitializeExchangePropertyContainerIfNeeded(sessionState, out adobjectId, out organizationId); ExchangePropertyContainer propertyContainer = ExchangePropertyContainer.GetPropertyContainer(sessionState); propertyContainer.logEnabled = false; propertyContainer.logEntries.DecreaseIndentation(); }
internal static void RefreshProvisioningBroker(ISessionState sessionState) { ExchangePropertyContainer propertyContainer = ExchangePropertyContainer.GetPropertyContainer(sessionState); if (propertyContainer == null) { throw new ArgumentException("sessionState"); } ExchangeRunspaceConfiguration exchangeRunspaceConfiguration = propertyContainer.exchangeRunspaceConfiguration; if (exchangeRunspaceConfiguration != null) { exchangeRunspaceConfiguration.RefreshProvisioningBroker(); } if (propertyContainer.provisioningBroker != null) { propertyContainer.provisioningBroker = null; } }
internal static ProvisioningBroker GetProvisioningBroker(ISessionState sessionState) { ExchangePropertyContainer propertyContainer = ExchangePropertyContainer.GetPropertyContainer(sessionState); if (propertyContainer == null) { throw new ArgumentException("sessionState"); } ExchangeRunspaceConfiguration exchangeRunspaceConfiguration = propertyContainer.exchangeRunspaceConfiguration; if (exchangeRunspaceConfiguration != null) { return(exchangeRunspaceConfiguration.GetProvisioningBroker()); } if (propertyContainer.provisioningBroker == null) { propertyContainer.provisioningBroker = new ProvisioningBroker(); } return(propertyContainer.provisioningBroker); }
internal static ExchangeRunspaceConfiguration UpdateExchangeRunspaceConfiguration(ISessionState sessionState) { WindowsIdentity current = WindowsIdentity.GetCurrent(); ExchangeRunspaceConfiguration exchangeRunspaceConfiguration = new ExchangeRunspaceConfiguration(current); if (!ExchangePropertyContainer.IsContainerInitialized(sessionState)) { ExchangePropertyContainer.InitExchangePropertyContainer(sessionState, exchangeRunspaceConfiguration); } else { ExchangePropertyContainer propertyContainer = ExchangePropertyContainer.GetPropertyContainer(sessionState); propertyContainer.exchangeRunspaceConfiguration = exchangeRunspaceConfiguration; if (propertyContainer.budget != null) { propertyContainer.budget.Dispose(); } propertyContainer.budget = ExchangePropertyContainer.AcquirePowerShellBudget(exchangeRunspaceConfiguration); } return(exchangeRunspaceConfiguration); }
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); }
internal static bool IsCmdletLogEnabled(ISessionState sessionState) { ExchangePropertyContainer propertyContainer = ExchangePropertyContainer.GetPropertyContainer(sessionState); return(propertyContainer != null && propertyContainer.logEnabled); }
internal static ExchangeRunspaceConfiguration GetExchangeRunspaceConfiguration(InitialSessionState initialSessionState) { ExchangePropertyContainer propertyContainer = ExchangePropertyContainer.GetPropertyContainer(initialSessionState); return(propertyContainer.exchangeRunspaceConfiguration); }