The implementation of the run space. This wraps the real run space object from powershell for use in the pool

Two possible ways of executing a command using different access point to the Runspace: - RunspaceInvoke: simple commands in string form, the command string can contain multiple commands and is basically the same form as what you use when typing a command in the exchange shell - PipelineInvoke: complex (multi) command structured pipelines which also allow complex parameters, like objects, to be passed in.

Наследование: IPowerShellSupport, IDisposable
Пример #1
0
 public void Dispose()
 {
     if (_powerShellSupport != null) {
         _powerShellSupport.Dispose();
         _powerShellSupport = null;
     }
 }
Пример #2
0
 internal ExchangePowerShellSupport(string configuredExchangeVersion, string exchangeUri, ConnectorMessages messageCatalog)
 {
     if (configuredExchangeVersion == null && exchangeUri != null) {
         LOGGER.TraceEvent(TraceEventType.Warning, CAT_DEFAULT, "No configured Exchange version. As auto-detection is not possible in remote mode, using 2010 as a default.");
         _exchangeVersion = ExchangeVersion.E2010;
     } else {
         _exchangeVersion = GetExchangeServerVersion(configuredExchangeVersion);
     }
     IList<string> snapins = new List<string>();
     if (exchangeUri == null) {
         switch(_exchangeVersion) {
             case ExchangeVersion.E2007:
                 // used for force load of the exchange dll's (untested in current version of the connector!)
                 AppDomain.CurrentDomain.AssemblyResolve += new ResolveEventHandler(AssemblyResolver2007);
                 snapins.Add(Exchange2007SnapIn);
                 break;
             case ExchangeVersion.E2010:
                 snapins.Add(Exchange2010SnapIn);
                 break;
             case ExchangeVersion.E2013:
                 snapins.Add(Exchange2013SnapIn);
                 break;
             default: throw new ArgumentException("Invalid server version: " + _exchangeVersion);
         }
     }
     _exchangeUri = exchangeUri;
     _messageCatalog = messageCatalog;
     _powerShellSupport = new PowerShellSupport(snapins, CreateExchangeRunspace, messageCatalog);
 }
Пример #3
0
 public MyRunspacePool(PowerShellSupport.CreateRunspaceDelegate createRunspaceDelegate)
 {
     _createRunspaceDelegate = createRunspaceDelegate;
 }