Fix error running PowerShell scripts in Windows 11: Updated and complete guide

Last update: 06/06/2025

  • The error when running scripts in PowerShell Windows 11 is due to default security restrictions.
  • There are several ways to modify the execution policy and enable scripts based on user needs.
  • Proper security configuration allows for controlled execution of scripts, minimizing risks to the system.
PowerShell Script Blocked Error

Have you recently encountered the annoying message “The file cannot be uploaded because script execution is disabled on this system." when trying to run a script in PowerShell on your Windows 11You're not alone. It's one of those situations that drives both novice users and experienced developers crazy. This type of error It usually appears when we want to automate tasks or test small scripts. And suddenly, the system stops us dead in our tracks due to an issue that seems hidden behind layers of security and unknown policies.

In this article I explain Everything you need to know about the PowerShell script execution error on Windows 11, using a friendly and practical approach so you can understand it even if you don't have much technical experience. We'll delve into the causes, security policies, troubleshooting steps, and the most recommended alternatives, taking into account your security and needs. I'll also clarify any frequently asked questions and some technical nuances that are often overlooked in other tutorials.

Why do I get a script execution error in PowerShell?

Error executing PowerShell script in Windows 11-9

The classic error message may vary slightly, but it almost always says something like: No se puede cargar el archivo <ruta_del_script> porque la ejecución de scripts está deshabilitada en este sistema. This warning does not mean that you have a virus or that your Windows is damaged.; the cause lies in how PowerShell security policies are configured.

Microsoft has been tightening security policies in each new version of Windows, especially since Windows 10 and Windows 11. By default, Execution of scripts in PowerShell is restricted to prevent malicious code from running uncontrolledThis is a positive thing for most users, but for developers and administrators, it can be an annoying limitation.

Exclusive content - Click Here  Windows 11 25H2: Official rollout, security, and how to install it

Some of the most common error messages are:

  • The file C:\my_script.ps1 cannot be loaded. Script execution is disabled on this system. See "Get-Help about_signing" for more information.
  • The file cannot be loaded because script execution is disabled on this system. For more information, see about_Execution_Policies.
  • The file C:\my_script.ps1 is not digitally signed. The script will not run on the system.

The basic reason is the execution policy configured in PowerShellThese policies define whether or not script files are allowed to run, and under what conditions. By default, the most restrictive policy is enabled: Restricted, which prevents any automatic execution of scripts.

What are PowerShell execution policies and why do they matter?

PowerShell execution policies

Windows PowerShell uses a system of Execution Policies to decide which scripts can run and under what circumstances.. This is essential for system security., as it prevents the launch of potentially harmful code downloaded from the Internet or received by email.

The main policies you can find are:

  • Restricted: This is the default policy in Windows 11. Does not allow the execution of any script, interactive commands only.
  • AllSigned: Only allow scripts and configuration files that are digitally signed by a trusted publisher to run.
  • RemoteSigned: Local scripts run without problems, but scripts downloaded from the Internet must be digitally signed by a trusted publisher.
  • Unrestricted: Allows you to run any script, although it displays a warning if the script comes from the Internet.

Choosing the right policy is essentialIf you just want to run a local script, RemoteSigned may be sufficient. If you're a developer and confident in your code, switching to Unrestricted may be sufficient, but always with caution.

How to identify the current execution policy in Windows 11?

Before changing anything, it is a good idea to know what policy you have active.. To check:

  • Open PowerShellYou can do this from the Start menu by searching for "PowerShell." If you need to make changes, do it as administrator.
  • Type the following command:
    Get-ExecutionPolicy -List

This will display a list of policies applied in different areas (User, Local System, Process, etc.). You will usually see “Restricted” as an active policy. In most cases.

Exclusive content - Click Here  How to erase a laptop with Windows 11

Solutions: How to enable script execution step by step

enable script execution in Powershell

There are several ways to solve the error, and each one It depends on the level of security you want to maintain. and the context in which you're working. Here are the main options:

Change execution policy temporarily (current session)

If you only need to run a script once and don't want the change to be permanent, you can do it like this:

  1. Open PowerShell as administrator.
  2. Run:
    Set-ExecutionPolicy -Scope Process -ExecutionPolicy Unrestricted

This only affects the PowerShell window you have open.. When you close it, the policy will return to its previous state.

Set an execution policy for the entire user or system

To make the change persist indefinitely, use one of these commands as appropriate:

  • For the current user:
    Set-ExecutionPolicy -Scope CurrentUser -ExecutionPolicy RemoteSigned
  • System-wide (requires administrator permissions):
    Set-ExecutionPolicy -Scope LocalMachine -ExecutionPolicy RemoteSigned

Parameter -ExecutionPolicy you can modify it to Unrestricted, AllSigned o RemoteSigned depending on what you require. RemoteSigned is often the most balanced option for users and developers.

Change the execution policy from Windows 11 settings

Another less technical alternative is to access the system options:

  1. Open Windows 11 Settings (you can tap Win + I).
  2. Go to Privacy and Security > For Developers.
  3. Look for the PowerShell section.
  4. Enables the option to run unsigned local scripts and requires signature only for remote scripts.

This method is ideal for those who don't want to touch commands and prefer a simple, graphical option.

Common mistakes and safety recommendations

Enabling script execution can be risky if what is executed is not well controlled.It is essential to follow these recommendations:

  • Do not download or run scripts from unknown sources.Even with less restrictive policies, remain cautious.
  • Use RemoteSigned whenever possible.
  • After running the necessary script, reestablishes the previous policy (for example, using Set-ExecutionPolicy Restricted).
  • In business environments or when handling critical scripts, Choose AllSigned or consult your system administrator..
Exclusive content - Click Here  Text processor

Special cases: PowerShell, Azure and incompatible versions

There are scenarios where the error may be due to something other than the execution policy. For example, with specific modules such as Azure Active Directory, Some modern versions of PowerShell are not supported, and this can trigger additional errors:

  • The Azure Active Directory classic module only works with PowerShell 3 to 5.1For higher versions, please look for alternative or updated versions of the module.
  • Always remember to run modules that require administration such as administrator to avoid insufficient permits.

If you lose track of your PowerShell version, simply run:
$PSVersionTable
to see all the information about it.

Additional troubleshooting and helpful resources

Advanced PowerShell-4 Tricks

Sometimes even applying the above commands you may still experience crashes. In such case:

  • Check if any Antivirus or company policy is preventing changes.
  • If the error only occurs with downloaded scripts, Check the file properties and unlock it (Right click > Properties > Unlock).
  • See official Microsoft help and specialized forums if it is a corporate environment with its own restrictive policies.

Remember that if you need additional help, you can always turn to the PowerShell user community or Microsoft support channels, since they are usually updated with the changes that are introduced version by version.

Understanding why Windows 11 restricts script execution in PowerShell is the first step toward working with scripts efficiently and securely. By following these recommendations, you'll resolve the error and learn how to better manage your runtime environment, getting more out of your automations and keeping your system protected. Change settings only when necessary and remember to reset policies for security after completing your tasks.

Advanced PowerShell-0 Tricks
Related article:
Advanced PowerShell Tricks for Administrators