Skip to content

PS_ExecuteCommand

Executes PowerShell command with Windows PowerShell
The output of the command is written to PSOut.log in gsTempDir (for computer jobs <gsWorkstationPath>Logs\Temp\PSOut.log)
If the command returns an exit code other than 0, the function fails the job
If execution policy has been set to “Restricted”, single Powershell commands can still be executed
If it is required to perform more than one command, it is recommended to insert the commands into a script and execute them with the function PS_ExecuteScript

PS_ExecuteCommand(sCommand) As Boolean

Powershell command that should be executed

If bStatus Then bStatus = PS_ExecuteCommand("Stop-process -processname notepad")
If bStatus Then bStatus = PS_ExecuteCommand("& {Stop-process -processname notepad}")

Scripting Guidelines

Constants Package Property Variables