PS_GetExecutionPolicy

Description

Returns PowerShellScript execution Policy for the local computer

The execution policy can be one of the following values:

  • Restricted: No scripts can be run, but single commands can be executed. Windows PowerShell can be used only in interactive mode
  • AllSigned: Only scripts signed by a trusted publisher can be run
  • RemoteSigned: Downloaded scripts must be signed by a trusted publisher before they can be run
  • Unrestricted: No restrictions; all Windows PowerShell scripts can be run

The default execution policy is 'Restricted'. Use the function PS_ExecuteCommand to execute the Set-ExecutionPolicy Cmdlet in order to change the policy


Syntax

PS_GetExecutionPolicy() As Boolean


Return value

The result will be stored in gsValue


Example

VBScript
If bStatus Then bStatus = PS_GetExecutionPolicy()
If bStatus Then bStatus = Job_WriteLog("Custom", "gsValue: " & gsValue(index), bStatus, True)

Scripting Guidelines


Related functions