How to fix PowerCLI and/or PowerShell running scripts is disabled

Posted by

I know this one should be real basic but sometimes we forget the basics.  Have you ever stood up a new environment, installed PowerShell, PowerCLI, imported your favorite scripts and when to execute and got a permission error.  Were you rusty on how to change permissions to give yourself the capability to run scripts?  Here is a quick article on how to change the ExecutionPolicy in PowerShell.

File C:\——\——\ExampleScript.ps1 cannot be loaded because running scripts is disabled on this system. For more information, see about_Execution_Policies at https:/

    + CategoryInfo          : SecurityError: (:) [], ParentContainsErrorRecordException

    + FullyQualifiedErrorId : UnauthorizedAccess

Machine generated alternative text:
bgcansø. rnnninq scripts is disabled on this system. For more information, see at https:/

How to fix:
Run the following command:

The result should say:

Use the following command to change it to unrestricted:
Set-ExecutionPolicy -ExecutionPolicy Unrestricted

Other options:
AllSigned – Only scripts signed by a trusted publisher can be run.
RemoteSigned – Downloaded scripts must be signed by a trusted publisher.

Not much to say besides I hope y’all found this article useful.

Leave a Reply