search cancel

PowerShell Run Script Tasks Fail to Run

book

Article ID: 163476

calendar_today

Updated On:

Products

Inventory Solution

Issue/Introduction

PowerShell Run Script Tasks (such as some custom inventory tasks) fail to run on some computers. The task details says that the execution of scripts is disabled on the system.

The task details of the failed task shows a message like this:
 

File C:\windows\TEMP\AltirisScript02CA61E07AAE456BB3.ps1 cannot be loaded because the execution of scripts is disabled on this system. Please see "get-help about_signing" for more details.

At line:1 char:2

+ & <<<< 'C:\windows\TEMP\AltirisScript02CA61E07AAE456BB3.ps1'

+ CategoryInfo : NotSpecified: (:) [], PSSecurityException

+ FullyQualifiedErrorId : RuntimeException

Cause

The PowerShell Execution Policy is locked down and prevents the Symantec Management Agent from running PowerShell Scripts.

Resolution

Create a Run Script task to modify the PowerShell Execution Policy on the computers to allow "Remote Signed" PowerShell scripts to run. To do this follow How to Modify Registry Keys and Entries with a Script Task to create a script task with the following command:

REG ADD HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\PowerShell\1\ShellIds\Microsoft.PowerShell /f /v ExecutionPolicy /t REG_SZ /d RemoteSigned