PS_ExecuteScript
Description
Section titled “Description”Executes a PowerShell script with Windows PowerShell
The output of the script is written to PSOut.log in gsTempDir (for computer jobs <gsWorkstationPath>Logs\Temp\PSOut.log)
If the script returns an exit code other than 0, the function fails the job
Syntax
Section titled “Syntax”PS_ExecuteScript(sScript, sScriptArguments, bSigned, bRunUnrestricted) As Boolean
Parameters
Section titled “Parameters”sScript (String)
Section titled “sScript (String)”Full path to and name of Powershell script that should be executed
sScriptArguments (String)
Section titled “sScriptArguments (String)”Script arguments
bSigned (Boolean)
Section titled “bSigned (Boolean)”Is the script signed. Set it to TRUE if the script is signed and the execution policy is AllSigned.
bRunUnrestricted (Boolean)
Section titled “bRunUnrestricted (Boolean)”Should the script be executed even though the execution policy prevents it. If TRUE, the script runs with -ExecutionPolicy Unrestricted.
If the execution policy is AllSigned and both bSigned and bRunUnrestricted are FALSE, the script isn’t run and the function fails the job.
Return value
Section titled “Return value”Boolean, TRUE if the script ran and returned exit code 0.
Example
Section titled “Example”If bStatus Then bStatus = PS_ExecuteScript(gsPackageRoot & "\Kit\CapaInstaller.ps1", "", False, True)