UtilPowerShellExecutePowerShellScript Method
Executes the specified PowerShell Script 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> ExecutePowerShellScript(
string script,
params string[] importModules
)
Public Shared Function ExecutePowerShellScript (
script As String,
ParamArray importModules As String()
) As Collection(Of PSObject)
Dim script As String
Dim importModules As String()
Dim returnValue As Collection(Of PSObject)
returnValue = UtilPowerShell.ExecutePowerShellScript(script,
importModules)
public:
static Collection<PSObject^>^ ExecutePowerShellScript(
String^ script,
... array<String^>^ importModules
)
static member ExecutePowerShellScript :
script : string *
importModules : string[] -> Collection<PSObject>
No code example is currently available or this language may not be supported.
- 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.
CollectionPSObject
A
CollectionT object that represents the script 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 results As Collection(Of PSObject) = ExecutePowerShellScript(script, 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.