Skip to main content

Execute-PowerShell

Command Description

Execute PowerShell, and return the text output by the console during the execution of PowerShell

Command Prototype

sRet = Sys.PowerShell(sCommand)

Parameter Description

ParameterRequiredTypeDefaultDescription
sCommandTruestring""The command(s) to execute

return

sRet,The variable used to save the output of the command.

Demo

/********************************Execute PowerShell**************** ******************** 
Command prototype:
sRet = Sys.PowerShell ("")
Input parameters:
sCommand--command line to execute
Outgoing parameters:
sRet--the result after the command is run
********************************************************************************/
Dim sCommand="date"
sRet = Sys.PowerShell (sCommand)
TracePrint (sRet)