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

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()

See also

PowerShell defines a type accelerator for this class which simply is [PowerShell].

Index