Exemplo n.º 1
0
        internal static CmdletLogEntries GetCmdletLogEntries(ISessionState sessionState)
        {
            ExchangePropertyContainer propertyContainer = ExchangePropertyContainer.GetPropertyContainer(sessionState);

            if (propertyContainer == null)
            {
                return(null);
            }
            return(propertyContainer.logEntries);
        }
Exemplo n.º 2
0
        internal static OrganizationId GetExecutingUserOrganizationId(ISessionState sessionState)
        {
            ExchangePropertyContainer propertyContainer = ExchangePropertyContainer.GetPropertyContainer(sessionState);

            if (propertyContainer == null)
            {
                return(null);
            }
            return(propertyContainer.executingUserOrganizationId);
        }
Exemplo n.º 3
0
        internal static ADServerSettings GetServerSettings(ISessionState sessionState)
        {
            ExchangePropertyContainer propertyContainer = ExchangePropertyContainer.GetPropertyContainer(sessionState);

            if (propertyContainer == null)
            {
                throw new ArgumentException("sessionState");
            }
            return(propertyContainer.serverSettings);
        }
Exemplo n.º 4
0
        internal static ExchangeRunspaceConfigurationSettings.ExchangeApplication GetPropagatedClientAppId(ISessionState sessionState)
        {
            ExchangePropertyContainer propertyContainer = ExchangePropertyContainer.GetPropertyContainer(sessionState);

            if (propertyContainer == null)
            {
                return(ExchangeRunspaceConfigurationSettings.ExchangeApplication.Unknown);
            }
            return(propertyContainer.propagatedClientAppId);
        }
Exemplo n.º 5
0
        internal static IPowerShellBudget GetPowerShellBudget(ISessionState sessionState)
        {
            ExchangePropertyContainer propertyContainer = ExchangePropertyContainer.GetPropertyContainer(sessionState);

            if (propertyContainer == null)
            {
                return(null);
            }
            return(propertyContainer.budget);
        }
Exemplo n.º 6
0
        internal static ExchangeRunspaceConfiguration GetExchangeRunspaceConfiguration(ISessionState sessionState)
        {
            ExchangePropertyContainer propertyContainer = ExchangePropertyContainer.GetPropertyContainer(sessionState);

            if (propertyContainer == null)
            {
                return(null);
            }
            return(propertyContainer.exchangeRunspaceConfiguration);
        }
Exemplo n.º 7
0
        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();
        }
Exemplo n.º 8
0
        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;
            }
        }
Exemplo n.º 9
0
        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);
        }
Exemplo n.º 10
0
        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);
        }
Exemplo n.º 11
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);
        }
Exemplo n.º 12
0
        internal static bool IsCmdletLogEnabled(ISessionState sessionState)
        {
            ExchangePropertyContainer propertyContainer = ExchangePropertyContainer.GetPropertyContainer(sessionState);

            return(propertyContainer != null && propertyContainer.logEnabled);
        }
Exemplo n.º 13
0
        internal static ExchangeRunspaceConfiguration GetExchangeRunspaceConfiguration(InitialSessionState initialSessionState)
        {
            ExchangePropertyContainer propertyContainer = ExchangePropertyContainer.GetPropertyContainer(initialSessionState);

            return(propertyContainer.exchangeRunspaceConfiguration);
        }