Example #1
0
        // Token: 0x0600102D RID: 4141 RVA: 0x00031488 File Offset: 0x0002F688
        private void InitializeLocalServerSettings(RunspaceServerSettingsPresentationObject serverSettings)
        {
            PSCommand pscommand = new PSCommand().AddCommand("Set-ADServerSettings");

            pscommand.AddParameter("RunspaceServerSettings", serverSettings);
            using (PowerShell powerShell = this.proxy.CreatePowerShell(pscommand))
            {
                try
                {
                    powerShell.Invoke();
                }
                catch (CmdletInvocationException ex)
                {
                    if (ex.InnerException != null)
                    {
                        throw ex.InnerException;
                    }
                    throw;
                }
                if (powerShell.Streams.Error.Count > 0)
                {
                    ErrorRecord errorRecord = powerShell.Streams.Error[0];
                    throw new CmdletInvocationException(errorRecord.Exception.Message, errorRecord.Exception);
                }
            }
        }
 internal void SetDefaultSettings()
 {
     base.DoBeginInit();
     this.ADServerSettings  = new RunspaceServerSettingsPresentationObject();
     this.ForestViewEnabled = true;
     base.DoEndInit(false);
 }
 public MonadMediatorPoolKey(MonadConnectionInfo connectionInfo, RunspaceServerSettingsPresentationObject serverSettings)
 {
     if (connectionInfo == null)
     {
         throw new ArgumentNullException("connectionInfo");
     }
     this.connectionInfo = connectionInfo;
     this.serverSettings = serverSettings;
 }
Example #4
0
 public override void Open(IUIService service, WorkUnitCollection workUnits, bool enforceViewEntireForest, ResultsLoaderProfile profile)
 {
     this.isResultPane = !enforceViewEntireForest;
     this.workUnits = workUnits;
     this.commandInteractionHandler = ((service != null) ? new WinFormsCommandInteractionHandler(service) : new CommandInteractionHandler());
     RunspaceServerSettingsPresentationObject runspaceServerSettingsPresentationObject = ADServerSettingsSingleton.GetInstance().CreateRunspaceServerSettingsObject();
     if (enforceViewEntireForest && runspaceServerSettingsPresentationObject != null)
     {
         runspaceServerSettingsPresentationObject.ViewEntireForest = true;
     }
     this.connection = new MonadConnection(PSConnectionInfoSingleton.GetInstance().GetConnectionStringForScript(), this.commandInteractionHandler, runspaceServerSettingsPresentationObject, PSConnectionInfoSingleton.GetInstance().GetMonadConnectionInfo(profile.SerializationLevel));
     this.connection.Open();
 }
        internal void EnforceADSettings()
        {
            ExTraceGlobals.ProgramFlowTracer.TraceFunction <ExchangeADServerSettings>(0L, "-->ExchangeSystemManagerSettings.EnforceAdSettings: {0}", this);
            if (this["ADServerSettings"] == null && !EnvironmentAnalyzer.IsWorkGroup() && OrganizationType.Cloud != PSConnectionInfoSingleton.GetInstance().Type)
            {
                try
                {
                    try
                    {
                        using (MonadConnection monadConnection = new MonadConnection("timeout=30", new CommandInteractionHandler(), null, PSConnectionInfoSingleton.GetInstance().GetMonadConnectionInfo()))
                        {
                            monadConnection.Open();
                            LoggableMonadCommand loggableMonadCommand = new LoggableMonadCommand("Get-ADServerSettingsForLogonUser", monadConnection);
                            object[]             array = loggableMonadCommand.Execute();
                            if (array != null && array.Length > 0)
                            {
                                RunspaceServerSettingsPresentationObject runspaceServerSettingsPresentationObject = array[0] as RunspaceServerSettingsPresentationObject;
                                this.ADServerSettings              = runspaceServerSettingsPresentationObject;
                                this.OrganizationalUnit            = runspaceServerSettingsPresentationObject.RecipientViewRoot;
                                this.ForestViewEnabled             = runspaceServerSettingsPresentationObject.ViewEntireForest;
                                this.GlobalCatalog                 = runspaceServerSettingsPresentationObject.UserPreferredGlobalCatalog;
                                this.ConfigurationDomainController = runspaceServerSettingsPresentationObject.UserPreferredConfigurationDomainController;
                                if (runspaceServerSettingsPresentationObject.UserPreferredDomainControllers != null && runspaceServerSettingsPresentationObject.UserPreferredDomainControllers.Count != 0)
                                {
                                    this.DomainController = runspaceServerSettingsPresentationObject.UserPreferredDomainControllers[0];
                                }
                            }
                            else
                            {
                                this.SetDefaultSettings();
                            }
                        }
                    }
                    catch (Exception)
                    {
                        this.SetDefaultSettings();
                    }
                    goto IL_11A;
                }
                finally
                {
                    this.waitHandle.Set();
                }
            }
            this.waitHandle.Set();
IL_11A:
            ExTraceGlobals.ProgramFlowTracer.TraceFunction <ExchangeADServerSettings>(0L, "<--ExchangeSystemManagerSettings.EnforceAdSettings: {0}", this);
        }
Example #6
0
 // Token: 0x0600100D RID: 4109 RVA: 0x00030D28 File Offset: 0x0002EF28
 internal MonadConnection(CommandInteractionHandler uiHandler, RunspaceMediator mediator, RunspaceServerSettingsPresentationObject serverSettings)
 {
     this.SyncRoot = new object();
     base..ctor();
     ExTraceGlobals.IntegrationTracer.Information((long)this.GetHashCode(), "new MonadConnection(RunspaceMediator)");
     if (uiHandler == null)
     {
         throw new ArgumentNullException("uiHandler");
     }
     if (mediator == null)
     {
         throw new ArgumentNullException("mediator");
     }
     this.pooled             = true;
     this.timeout            = 0;
     this.InteractionHandler = uiHandler;
     this.mediator           = mediator;
     this.state          = ConnectionState.Closed;
     this.serverSettings = serverSettings;
 }
Example #7
0
 // Token: 0x0600100B RID: 4107 RVA: 0x00030C2C File Offset: 0x0002EE2C
 public MonadConnection(string connectionString, CommandInteractionHandler uiHandler, RunspaceServerSettingsPresentationObject serverSettings, MonadConnectionInfo connectionInfo)
 {
     this.SyncRoot = new object();
     base..ctor();
     ExTraceGlobals.IntegrationTracer.Information <string>((long)this.GetHashCode(), "new MonadConnection({0})", connectionString);
     if (uiHandler == null)
     {
         throw new ArgumentNullException("uiHandler");
     }
     if (string.IsNullOrEmpty(connectionString))
     {
         throw new ArgumentException("Argument 'connectionString' was null or emtpy.");
     }
     this.pooled             = true;
     this.timeout            = 0;
     this.ConnectionString   = connectionString;
     this.InteractionHandler = uiHandler;
     this.state = ConnectionState.Closed;
     if (connectionInfo != null)
     {
         this.remote = true;
         if (this.pooled)
         {
             this.mediator = MonadConnection.mediatorPool.GetRunspacePooledMediatorInstance(new MonadMediatorPoolKey(connectionInfo, serverSettings));
         }
         else
         {
             this.mediator = new RunspaceMediator(new MonadRemoteRunspaceFactory(connectionInfo, serverSettings), new EmptyRunspaceCache());
         }
     }
     else if (this.pooled)
     {
         this.mediator = MonadConnection.mediatorPool.GetRunspacePooledMediatorInstance();
     }
     else
     {
         this.mediator = MonadConnection.mediatorPool.GetRunspaceNonPooledMediatorInstance();
     }
     this.serverSettings = serverSettings;
 }
Example #8
0
 // Token: 0x0600100A RID: 4106 RVA: 0x00030C1E File Offset: 0x0002EE1E
 public MonadConnection(string connectionString, CommandInteractionHandler uiHandler, RunspaceServerSettingsPresentationObject serverSettings) : this(connectionString, uiHandler, serverSettings, null)
 {
 }
Example #9
0
 public MonadRemoteRunspaceFactory(MonadConnectionInfo connectionInfo, RunspaceServerSettingsPresentationObject serverSettings) : base(new RunspaceConfigurationFactory(), MonadHostFactory.GetInstance(), connectionInfo)
 {
     this.clientVersion  = connectionInfo.ClientVersion;
     this.serverSettings = serverSettings;
 }
Example #10
0
 private static void LoadBaseUrlViaCmdlet(HelpProvider.HelpAppName appName, RunspaceServerSettingsPresentationObject runspaceServerSettings, MonadConnectionInfo monadConnectionInfo)
 {
     if (appName != HelpProvider.HelpAppName.Toolbox)
     {
         if (appName != HelpProvider.HelpAppName.Eap)
         {
             throw new InvalidOperationException("appName is not a valid HelpAppName enum. Check caller of Initialize how we get this value.");
         }
     }
     try
     {
         ExchangeAssistance exchangeAssistance = null;
         MonadConnection    connection         = new MonadConnection("timeout=30", new CommandInteractionHandler(), runspaceServerSettings, monadConnectionInfo);
         using (new OpenConnection(connection))
         {
             using (MonadCommand monadCommand = new MonadCommand("Get-ExchangeAssistanceConfig", connection))
             {
                 object[] array = monadCommand.Execute();
                 if (array != null && array.Length != 0)
                 {
                     exchangeAssistance = (array[0] as ExchangeAssistance);
                 }
             }
         }
         if (exchangeAssistance != null)
         {
             if (exchangeAssistance.ManagementConsoleHelpURL != null)
             {
                 HelpProvider.baseUrl = Utilities.NormalizeUrl(exchangeAssistance.ManagementConsoleHelpURL);
             }
             if (exchangeAssistance.ManagementConsoleFeedbackEnabled)
             {
                 HelpProvider.managementConsoleFeedbackUrl = exchangeAssistance.ManagementConsoleFeedbackURL;
             }
             else
             {
                 HelpProvider.managementConsoleFeedbackUrl = null;
             }
             if (exchangeAssistance.PrivacyLinkDisplayEnabled)
             {
                 HelpProvider.privacyStatementUrl = exchangeAssistance.PrivacyStatementURL;
             }
             else
             {
                 HelpProvider.privacyStatementUrl = null;
             }
             if (exchangeAssistance.WindowsLiveAccountURLEnabled)
             {
                 HelpProvider.windowsLiveAccountUrl = exchangeAssistance.WindowsLiveAccountPageURL;
             }
             else
             {
                 HelpProvider.windowsLiveAccountUrl = null;
             }
             if (exchangeAssistance.CommunityLinkDisplayEnabled)
             {
                 HelpProvider.communityUrl = exchangeAssistance.CommunityURL;
             }
             else
             {
                 HelpProvider.communityUrl = null;
             }
         }
     }
     catch (CommandExecutionException ex)
     {
         ExTraceGlobals.CoreTracer.TraceDebug <string>(0L, "CommandExecution Exception in LoadBaseURL: {0}", ex.Message);
     }
     catch (CmdletInvocationException ex2)
     {
         ExTraceGlobals.CoreTracer.TraceDebug <string>(0L, "CmdletInvocationException Exception in LoadBaseURL: {0}", ex2.Message);
     }
     catch (PipelineStoppedException ex3)
     {
         ExTraceGlobals.CoreTracer.TraceDebug <string>(0L, "PipelineStopped Exception in LoadBaseURL: {0}", ex3.Message);
     }
     HelpProvider.callingAppName = appName;
 }
Example #11
0
 public static void InitializeViaCmdlet(HelpProvider.HelpAppName appName, RunspaceServerSettingsPresentationObject runspaceServerSettings, MonadConnectionInfo monadConnectionInfo)
 {
     HelpProvider.LoadBaseUrlViaCmdlet(appName, runspaceServerSettings, monadConnectionInfo);
     HelpProvider.initializedViaCmdlet = true;
 }