When you download and attempt to run a PowerShell script (a .ps1 file extension) from the internet, you see the following security warning:

Run only scripts that you trust. While scripts from the internet can be useful, this script can potentially harm your computer. If you trust this script, use the Unblock-File cmdlet to allow the script to run without this warning message. Do you want to run {script name}?



Windows prevents downloaded internet files from being runnable as part of built-in Windows security. This is designed to prevent malicious scripts from running on your machine. This error message will even appear when your PowerShell ExecutionPolicy is set to Unrestricted. To adjust your execution policy settings, see PowerShell Execution Policy Settings.


The temporary solution to this problem is to click the Run once button each time you want to run the script. However, if you need to run this script frequently this warning message can be annoying. There are three permanent solutions to fix the issue.

Option 1: Bypass ExecutionPolicy

As mentioned above, an Unrestricted execution policy does not prevent the error message from appearing. To disable all warning messages permanently for any downloaded internet files, you need to use the Bypass ExecutionPolicy. However, this command unblocks every script you download, trustworthy or not.

To execute this command, open a PowerShell window with administrator privileges and run the following:

Set-ExecutionPolicy Bypass

You can also reset the ExecutionPolicy back to its default setting of Restricted using

Set-ExecutionPolicy Restricted

Option 2: Unblock-File cmdlet

Instead of changing permissions for every script in PowerShell (Option 1), we can instead unblock only the file we need. To do this, we need to run the Unblock-File cmdlet recommended in the warning message above. To unblock the file, run the following command:

Unblock-File script_name.ps1

NOTE:  you do not need elevated permissions to run this command.

Option 3: File Properties

The final option is to change the properties of he file itself. Since the file was downloaded, Windows allows you access to change the file’s properties.To unblock the file:

  1. Browse to the file using Windows Explorer
  2. Right-click the file and select Properties.
  3. On the General tab, under Security, click the Unblock checkbox.
  4. Click OK.



This article has shown you three ways to solve the issue of running blocked PowerShell scripts downloaded from the internet. It’s recommended you grant the least permissions possible (Option 2 or Option 3) before making sweeping changes (Option 1).