C# Класс Org.IdentityConnectors.ActiveDirectory.PowerShellSupport

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
Показать файл Открыть проект Примеры использования класса

Открытые методы

Метод Описание
CheckErrorsFromReader ( PipelineReader reader ) : void

Checks whether errors reader contains some error, if so the errors are concatenated and exception is thrown, throws ConnectorException if the errors parameter is not empty Introduced because of "Problem while PowerShell execution System.NotSupportedException: Specified method is not supported. at System.Management.Automation.Internal.PSDataCollectionPipelineReader`2.ReadToEnd()" (occurring on Exchange 2010/Windows Server 2008 R2)

CheckErrorsFromReader ( PipelineReader reader, ThrowIcfExceptionDelegate throwIcfExceptionDelegate ) : void
DefaultRunspaceCreateMethod ( ) : System.Management.Automation.Runspaces.Runspace
Dispose ( ) : void

Implementation of IDisposable

InvokePipeline ( Collection commands ) : ICollection

invoke the powershell pipeline

InvokePipeline ( System.Management.Automation.Runspaces.Command item ) : ICollection

invoke the pipeline

InvokeScript ( string script, ICollection parameters ) : ICollection
InvokeScriptInternal ( System.Management.Automation.Runspaces.Runspace runspace, string script, ICollection parameters ) : ICollection
PowerShellSupport ( IList localSnapinNames, CreateRunspaceDelegate createRunspaceMethod, ConnectorMessages messageCatalog ) : System

Initializes a new instance of the PowerShellSupport class.

ProcessRunspaceException ( System.Management.Automation.Runspaces.Runspace runspace, int attempt, System.Management.Automation.Runspaces.InvalidRunspaceStateException e ) : void
Test ( ) : void

Test the state of this PowerShellSupport, throws InvalidRunspaceStateException if in incorrect state

Приватные методы

Метод Описание
AddError ( IList errors, object error ) : void
CheckErrors ( IList errors ) : void

Checks whether errors List contains some error, if so the errors are concatenated and exception is thrown, throws ConnectorException if the errors parameter is not empty

CheckErrors ( IList errors, ThrowIcfExceptionDelegate throwIcfExceptionDelegate ) : void
DefaultThrowIcfExceptionImplementation ( Exception e, ErrorRecord error, string message ) : void
Dispose ( bool disposing ) : void

Dispose/Finalize pattern

InvokePipelineInternal ( System.Management.Automation.Runspaces.Runspace runspace, Collection commands ) : ICollection

Описание методов

CheckErrorsFromReader() публичный статический Метод

Checks whether errors reader contains some error, if so the errors are concatenated and exception is thrown, throws ConnectorException if the errors parameter is not empty Introduced because of "Problem while PowerShell execution System.NotSupportedException: Specified method is not supported. at System.Management.Automation.Internal.PSDataCollectionPipelineReader`2.ReadToEnd()" (occurring on Exchange 2010/Windows Server 2008 R2)
public static CheckErrorsFromReader ( PipelineReader reader ) : void
reader PipelineReader pipeline reader
Результат void

CheckErrorsFromReader() публичный статический Метод

public static CheckErrorsFromReader ( PipelineReader reader, ThrowIcfExceptionDelegate throwIcfExceptionDelegate ) : void
reader PipelineReader
throwIcfExceptionDelegate ThrowIcfExceptionDelegate
Результат void

DefaultRunspaceCreateMethod() публичный Метод

public DefaultRunspaceCreateMethod ( ) : System.Management.Automation.Runspaces.Runspace
Результат System.Management.Automation.Runspaces.Runspace

Dispose() публичный Метод

Implementation of IDisposable
public Dispose ( ) : void
Результат void

InvokePipeline() публичный Метод

invoke the powershell pipeline
public InvokePipeline ( Collection commands ) : ICollection
commands Collection a collection of commands to execute
Результат ICollection

InvokePipeline() публичный Метод

invoke the pipeline
public InvokePipeline ( System.Management.Automation.Runspaces.Command item ) : ICollection
item System.Management.Automation.Runspaces.Command a command to execute
Результат ICollection

InvokeScript() публичный Метод

public InvokeScript ( string script, ICollection parameters ) : ICollection
script string
parameters ICollection
Результат ICollection

InvokeScriptInternal() публичный Метод

public InvokeScriptInternal ( System.Management.Automation.Runspaces.Runspace runspace, string script, ICollection parameters ) : ICollection
runspace System.Management.Automation.Runspaces.Runspace
script string
parameters ICollection
Результат ICollection

PowerShellSupport() публичный Метод

Initializes a new instance of the PowerShellSupport class.
Thrown when is null.
public PowerShellSupport ( IList localSnapinNames, CreateRunspaceDelegate createRunspaceMethod, ConnectorMessages messageCatalog ) : System
localSnapinNames IList Local snapins to be loaded
createRunspaceMethod CreateRunspaceDelegate A method used to create a new runspace (if null, a default implementation is used)
messageCatalog ConnectorMessages The message catalog used for conveying localized messages.
Результат System

ProcessRunspaceException() публичный Метод

public ProcessRunspaceException ( System.Management.Automation.Runspaces.Runspace runspace, int attempt, System.Management.Automation.Runspaces.InvalidRunspaceStateException e ) : void
runspace System.Management.Automation.Runspaces.Runspace
attempt int
e System.Management.Automation.Runspaces.InvalidRunspaceStateException
Результат void

Test() публичный Метод

Test the state of this PowerShellSupport, throws InvalidRunspaceStateException if in incorrect state
public Test ( ) : void
Результат void