how can i enable running scripts is disabled on this system.

ASIEDU OBED 0 Reputation points
2026-10-17T03:49:00.84+00:00

npm : File C:\npm.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.

At line:1 char:1

  • npm init
  • 
        + CategoryInfo          : SecurityError: (:) [], PSSecurityExcept 
    
       ion
    
        + FullyQualifiedErrorId : UnauthorizedAccess
    
    
Windows for business | Windows Server | User experience | PowerShell
0 comments No comments

2 answers

Sort by: Oldest
  1. AI answer

    2026-10-17T03:49:36.6533333+00:00

    Set the PowerShell execution policy to RemoteSigned for your user account, then run npm init again.

    Set-ExecutionPolicy -ExecutionPolicy RemoteSigned -Scope CurrentUser
    Get-ExecutionPolicy
    npm init
    

    Accept the confirmation prompt by entering Y. The change takes effect immediately, does not require administrator privileges at CurrentUser scope, and persists for your account. RemoteSigned permits local scripts such as npm.ps1 while requiring downloaded scripts to be signed or explicitly unblocked.^1^

    Avoid setting Bypass or Unrestricted system-wide; those policies remove protections that are unnecessary for this npm error.

    If the error continues

    Display every applicable policy:

    Get-ExecutionPolicy -List
    

    PowerShell applies policies in this order: MachinePolicy, UserPolicy, Process, CurrentUser, and LocalMachine, with Group Policy overriding settings configured through Set-ExecutionPolicy.^2^

    • If MachinePolicy or UserPolicy is Restricted or AllSigned, the device is probably managed through Group Policy. Contact the administrator rather than attempting to bypass it.
    • An administrator can configure Turn on Script Execution under: Computer Configuration or User Configuration → Administrative Templates → Windows Components → Windows PowerShell
    • The appropriate managed setting is normally Allow local scripts and remote signed scripts, equivalent to RemoteSigned.^3^

    If policy permits scripts but a later message says a particular script is not digitally signed, only unblock that file when its source is trusted:

    Unblock-File -Path "C:\path\to\trusted-script.ps1"
    

    References

    1. Chapter 1 - Getting started with PowerShell
    2. about_Execution_Policies
    3. about_Group_Policy_Settings
    AI-generated content may be incorrect. Read our transparency notes for more information.

    Was this answer helpful?

  2. Dio Xavier 297.7K Reputation points Volunteer Moderator
    2026-10-17T17:14:51.0866667+00:00

    Hello,

    Welcome to the Microsoft Windows Community.

    Good afternoon. Based on your description—and given that you are in a corporate environment—you will need to contact your company's IT department to request permission to execute scripts via Group Policy.

    Was this answer helpful?

    0 comments No comments

Your answer

Answers can be marked as 'Accepted' by the question author and 'Recommended' by moderators, which helps users know the answer solved the author's problem.