UtilPowerShellExecutePowerShellAction Method
Executes the specified ActionT and returns the execution results.
Namespace: DevCase.Core.Diagnostics.PowerShellAssembly: DevCase.net48 (in DevCase.net48.dll) Version: 6.0.0.0 (6.0)
XMLNS for XAML: Not mapped to an xmlns.
public static Collection<PSObject> ExecutePowerShellAction(
Action<PowerShell> powerShellAction,
params string[] importModules
)
Public Shared Function ExecutePowerShellAction (
powerShellAction As Action(Of PowerShell),
ParamArray importModules As String()
) As Collection(Of PSObject)
Dim powerShellAction As Action(Of PowerShell)
Dim importModules As String()
Dim returnValue As Collection(Of PSObject)
returnValue = UtilPowerShell.ExecutePowerShellAction(powerShellAction,
importModules)
public:
static Collection<PSObject^>^ ExecutePowerShellAction(
Action<PowerShell^>^ powerShellAction,
... array<String^>^ importModules
)
static member ExecutePowerShellAction :
powerShellAction : Action<PowerShell> *
importModules : string[] -> Collection<PSObject>
No code example is currently available or this language may not be supported.
- powerShellAction ActionPowerShell
-
The source ActionT to execute.
- importModules String
-
Specifies PowerShell's module names to import.
CollectionPSObject
A
CollectionT object that represents the
ActionT execution results.
This is a code example.
No code example is currently available or this language may not be supported.
Dim importModules As String() = {"Dism", "PSReadline", "WindowsSearch"}
Dim script As String = "Get-Module | Format-Table -Property Name, Version, Moduletype | Out-String"
Dim powerShellAction As New Action(Of PowerShell)(
Sub(ps As PowerShell)
ps.AddScript(script)
End Sub)
Dim results As Collection(Of PSObject) = ExecutePowerShellAction(powerShellAction, importModules)
Debug.WriteLine(results.Single().ToString())
No code example is currently available or this language may not be supported.
No code example is currently available or this language may not be supported.
No code example is currently available or this language may not be supported.
No code example is currently available or this language may not be supported.