Tech 1 min read

PowerShell Profile Load Error (Script Execution Disabled)

IkesanContents

The Error Message

. : File C:\Users\******\OneDrive\Documents\WindowsPowerShell\Microsoft.PowerShell_profile.ps1 cannot be loaded because script execution is disabled on this system. For more information, see "about_Execution_Policies" (https://go.microsoft.com/fwlink/?LinkID=135170).
At line:1 char:3
+ . 'C:\Users\******\OneDrive\Documents\WindowsPowerShell\Microsoft.PowerSh ...
+    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : SecurityError: (:) [], PSSecurityException
    + FullyQualifiedErrorId : UnauthorizedAccess

Cause

PowerShell’s execution policy is set to something like the default Restricted, so loading the profile script gets blocked.


Fix

Set the policy to allow local scripts for the current user.

Set-ExecutionPolicy RemoteSigned -Scope CurrentUser

Bonus

I was not actually that bothered by it, and then I realized fnm was conflicting with Volta. I think I installed fnm when I was setting up NDLOCR, so I will probably write up that setup later if I remember.