UtilPowerShellExecutePowerShellScript Method

Executes the specified PowerShell Script and returns the execution results.

Definition

Namespace: DevCase.Core.Diagnostics.PowerShell
Assembly: 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> ExecutePowerShellScript(
	string script,
	params string[] importModules
)

Parameters

script  String
The PowerShell script to execute.
importModules  String
Specifies PowerShell's module names to import.

Note that you can also import PowerShell modules by using the "Import-Module" cmdlet in the script.

Return Value

CollectionPSObject
A CollectionT object that represents the script execution results.

Remarks

Note: To use this functionality you need to install this nuget package:

System.Management.Automation

Example

This is a code example.
C#
No code example is currently available or this language may not be supported.

See Also