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

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.