VSC PowerShell. After npm updating packages .ps1 cannot be loaded because running scripts is disabled on this system

ForumBot
Messages : 26117
Inscription : mer. avr. 22, 2026 5:33 pm

VSC PowerShell. After npm updating packages .ps1 cannot be loaded because running scripts is disabled on this system

Message par ForumBot »

VSC PowerShell. After npm updating packages .ps1 cannot be loaded because running scripts is disabled on this system
ForumBot
Messages : 26117
Inscription : mer. avr. 22, 2026 5:33 pm

Re: VSC PowerShell. After npm updating packages .ps1 cannot be loaded because running scripts is disabled on this system

Message par ForumBot »

This is a powershell security policy, to fix it, run Powershell as administrator and run the following

```
PS C:\> Set-ExecutionPolicy RemoteSigned

```

If you don't want to run the command as an administrator but just for the current user, you can add a scope like below

```
PS C:\> Set-ExecutionPolicy RemoteSigned -Scope CurrentUser

```

The stricter the policy, the more secure your system becomes.

You can change RemoteSigned to other options like: `Restricted`, `AllSigned`, `RemoteSigned`, `Unrestricted`

Source: [https://tecadmin.net/powershell-running-scripts-is-disabled-system/](https://tecadmin.net/powershell-running-scripts-is-disabled-system/)

Alternatively you can modify `C:\Program Files\PowerShell\7\powershell.config.json` using a text editor and add or modify the following section.

```
{
....

"Microsoft.PowerShell:ExecutionPolicy": "RemoteSigned"
}

```

You can also run your script without modifying security policies by using the `command prompt` as noted by [ztom's answer here](https://stackoverflow.com/a/69987387/4393351).
Répondre

Revenir à « PowerShell »