C# Class 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.

Inheritance: IPowerShellSupport, IDisposable
Exibir arquivo Open project: Evolveum/openicf Class Usage Examples

Public Methods

Method Description
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

Private Methods

Method Description
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

Method Details

CheckErrorsFromReader() public static method

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
return void

CheckErrorsFromReader() public static method

public static CheckErrorsFromReader ( PipelineReader reader, ThrowIcfExceptionDelegate throwIcfExceptionDelegate ) : void
reader PipelineReader
throwIcfExceptionDelegate ThrowIcfExceptionDelegate
return void

DefaultRunspaceCreateMethod() public method

public DefaultRunspaceCreateMethod ( ) : System.Management.Automation.Runspaces.Runspace
return System.Management.Automation.Runspaces.Runspace

Dispose() public method

Implementation of IDisposable
public Dispose ( ) : void
return void

InvokePipeline() public method

invoke the powershell pipeline
public InvokePipeline ( Collection commands ) : ICollection
commands Collection a collection of commands to execute
return ICollection

InvokePipeline() public method

invoke the pipeline
public InvokePipeline ( System.Management.Automation.Runspaces.Command item ) : ICollection
item System.Management.Automation.Runspaces.Command a command to execute
return ICollection

InvokeScript() public method

public InvokeScript ( string script, ICollection parameters ) : ICollection
script string
parameters ICollection
return ICollection

InvokeScriptInternal() public method

public InvokeScriptInternal ( System.Management.Automation.Runspaces.Runspace runspace, string script, ICollection parameters ) : ICollection
runspace System.Management.Automation.Runspaces.Runspace
script string
parameters ICollection
return ICollection

PowerShellSupport() public method

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.
return System

ProcessRunspaceException() public method

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
return void

Test() public method

Test the state of this PowerShellSupport, throws InvalidRunspaceStateException if in incorrect state
public Test ( ) : void
return void