Search notes:
System.Management.Automation.PowerShell (class)
System.Management.Automation.PowerShell is used to host Windows PowerShell in an application.
System.Management.Automation.PowerShell represents a
PowerShell command or PowerShell script.
This class provides methods that create a pipeline of commands and then execute those commands in a runspace.
Constructor
The constructor
- creates an instance of
PSCommand and assigns it to the private member psCommand
- creates an instance of
PSDataStreams and assigns it to the private member dataStreams
Properties, Methods and events
| `AddArgument() | |
| `AddCommand() | |
| `AddParameter() | |
| `AddParameters() | |
| `AddScript() | |
| `AddStatement() | |
| `BeginInvoke() | |
| `BeginStop() | |
| `Commands | |
| `Connect() | |
| `ConnectAsync() | |
| `Create() | |
| `CreateNestedPowerShell() | |
| `Dispose() | |
| `EndInvoke() | |
| `EndStop() | |
| `GetSteppablePipeline() | |
| `HadErrors | |
| `HistoryString | |
| `InstanceId | |
| `InvocationStateChanged() | Event |
| `InvocationStateInfo | |
| `Invoke() | |
| `InvokeAsync() | |
| `IsNested | |
| `IsRunspaceOwner | |
| `Runspace | |
| `RunspacePool | |
| `Stop() | |
| `StopAsync() | |
| `Streams | |
AddScript()
[PowerShell] $ps = [PowerShell]::Create()
$scr = $ps.AddScript("$pwd\the-script.ps1")
$res = $scr.Invoke()