UtilPowerShellExecutePowerShellCommand(String, IDictionary, String) Method

Executes the specified PowerShell command 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> ExecutePowerShellCommand(
	string command,
	IDictionary parameters,
	params string[] importModules
)

Parameters

command  String
The PowerShell command to execute.
parameters  IDictionary
A dictionary of parameters. Each key-value pair corresponds to a parameter name and its value. The dictionary keys must be strings.
importModules  String
Specifies PowerShell's module names to import.

Return Value

CollectionPSObject
A CollectionT object that represents the command 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