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
Afficher le fichier Open project: Evolveum/openicf Class Usage Examples

Méthodes publiques

Méthode 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

Méthode 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 méthode

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
Résultat void

CheckErrorsFromReader() public static méthode

public static CheckErrorsFromReader ( PipelineReader reader, ThrowIcfExceptionDelegate throwIcfExceptionDelegate ) : void
reader PipelineReader
throwIcfExceptionDelegate ThrowIcfExceptionDelegate
Résultat void

DefaultRunspaceCreateMethod() public méthode

public DefaultRunspaceCreateMethod ( ) : System.Management.Automation.Runspaces.Runspace
Résultat System.Management.Automation.Runspaces.Runspace

Dispose() public méthode

Implementation of IDisposable
public Dispose ( ) : void
Résultat void

InvokePipeline() public méthode

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

InvokePipeline() public méthode

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

InvokeScript() public méthode

public InvokeScript ( string script, ICollection parameters ) : ICollection
script string
parameters ICollection
Résultat ICollection

InvokeScriptInternal() public méthode

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

PowerShellSupport() public méthode

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.
Résultat System

ProcessRunspaceException() public méthode

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
Résultat void

Test() public méthode

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