| PowerShellRunAsynchronously Method |
Runs a PowerShell command/script asynchronously.
Namespace:
Galactic.PowerShell
Assembly:
Galactic.PowerShell (in Galactic.PowerShell.dll) Version: 1.3.0.499 (1.3.0.499)
Syntax public static WaitHandle RunAsynchronously(
string commandText,
ref RunspacePool pool,
PowerShellProcessResults callback,
EventLog log = null,
PSDataCollection<string> input = null,
Dictionary<string, Object> stateValues = null,
params KeyValuePair<string, Object>[] parameterList
)
Public Shared Function RunAsynchronously (
commandText As String,
ByRef pool As RunspacePool,
callback As PowerShellProcessResults,
Optional log As EventLog = Nothing,
Optional input As PSDataCollection(Of String) = Nothing,
Optional stateValues As Dictionary(Of String, Object) = Nothing,
ParamArray parameterList As KeyValuePair(Of String, Object)()
) As WaitHandle
public:
static WaitHandle^ RunAsynchronously(
String^ commandText,
RunspacePool^% pool,
PowerShellProcessResults^ callback,
EventLog^ log = nullptr,
PSDataCollection<String^>^ input = nullptr,
Dictionary<String^, Object^>^ stateValues = nullptr,
... array<KeyValuePair<String^, Object^>>^ parameterList
)
static member RunAsynchronously :
commandText : string *
pool : RunspacePool byref *
callback : PowerShellProcessResults *
?log : EventLog *
?input : PSDataCollection<string> *
?stateValues : Dictionary<string, Object> *
parameterList : KeyValuePair<string, Object>[]
(* Defaults:
let _log = defaultArg log null
let _input = defaultArg input null
let _stateValues = defaultArg stateValues null
*)
-> WaitHandle
Parameters
- commandText
- Type: SystemString
The text of the command to run. - pool
- Type: RunspacePool
An open PowerShell Runspace pool this script will use to invoke its pipeline. - callback
- Type: Galactic.PowerShellPowerShellProcessResults
The callback function used to process the results of the asynchronous run. - log (Optional)
- Type: Galactic.EventLogEventLog
[Optional] The event log to log execptions to. May be null for no logging. - input (Optional)
- Type: PSDataCollectionString
[Optional] A collection of strings representing command-line input sent to the script during execution. - stateValues (Optional)
- Type: System.Collections.GenericDictionaryString, Object
[Optional] A collection of named state values that should be passed through the invocation to the callback function. - parameterList
- Type: System.Collections.GenericKeyValuePairString, Object
An array of key/value objects defining additional parameters to supply to the PowerShell script.
Return Value
Type:
WaitHandleAn WaitHandle object that can be used to determine when the scrip has completed execution. Null if an error occurred while processing the command / script.
See Also