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:/go.microsoft.com/fwlink/?LinkID=135170.
+ CategoryInfo : SecurityError: (:) , ParentContainsErrorRecordException
+ FullyQualifiedErrorId : UnauthorizedAccess
How to fix:
Run the following command:
The result should say:
Use the following command to change it to unrestricted:
Set-ExecutionPolicy -ExecutionPolicy Unrestricted
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.