Categories
How-To Software

Tech Short: “execution of scripts is disabled on this system.”

Attempting to run a PowerShell script I got the following error:

File C:\Work\ps.ps1 cannot be loaded because running scripts is disabled on this system. For more information, see about_Execution_Policies at http://go.microsoft.com/fwlink/?LinkID=135170.
+ CategoryInfo : SecurityError: (:) [], ParentContainsErrorRecordException
+ FullyQualifiedErrorId : UnauthorizedAccess

To run PowerShell scripts (files that end with .ps1), you must set the execution policy to Unrestricted. This is done by issuing the following command in powersehll

Set-ExecutionPolicy Unrestricted

*note* you need to do this in a elevated powershell (run it as administrator)

Once you do that, Windows will allow you to execute any .ps1 file.

 

2 replies on “Tech Short: “execution of scripts is disabled on this system.””

weve also had customers set it via gpo

Configuration\Administrative Templates\Windows Components\Windows PowerShell

and configure the Turn On Script Execution setting

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.