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.

If you would like assistance in the below or have general questions about Cloud solutions, VMware, and more, feel free to visit the following URL and I will be able to work directly with you:
https://bit.ly/3qcNxsN

Error:
File C:\——\——\ExampleScript.ps1 cannot be loaded because running scripts is disabled on this system. For more information, see about_Execution_Policies at https:/go.microsoft.com/fwlink/?LinkID=135170.

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

    + FullyQualifiedErrorId : UnauthorizedAccess

Machine generated alternative text:
bgcansø. rnnninq scripts is disabled on this system. For more information, see at https:/go.microsoft.cexn/fB1ink/?Link1D=135170.L

How to fix:
Run the following command:
Get-ExecutionPolicy

The result should say:
Restricted

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.

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

Leave a Reply