Frequently Asked Question

How to fix “running scripts is disabled on this system” when launching a PowerShell (.ps1) script
Last Updated about a month ago

Symptom


When running a PowerShell script (e.g. an N4V installation or maintenance script), the following error appears:

File C:\...\script.ps1 cannot be loaded because running scripts is disabled on this system.
For more information, see about_Execution_Policies.

The script does not run.

Reason and Prerequisites

Environment

  • Windows Server / Windows 10–11
  • Windows PowerShell 5.1 or PowerShell 7+
  • Any PowerShell script (.ps1) provided by Need4Viz

Cause
Windows applies a PowerShell execution policy that blocks scripts by default (Restricted policy). This is a Windows security setting, not an N4V issue.

Resolution

  1. Open PowerShell (as Administrator if the script requires it) and go to the script folder.
  2. Allow script execution for the current session only:

powershell

   Set-ExecutionPolicy -Scope Process -ExecutionPolicy Bypass
  1. Run the script:

powershell

   .\script.ps1
  1. Close the PowerShell window when finished. The policy reverts automatically; no permanent change is made to the system.

Other resolution

  • Run the script in one command, without changing any setting:

powershell

  powershell -ExecutionPolicy Bypass -File .\script.ps1
  • Allow scripts permanently for the current user (if you run scripts regularly):

powershell

  Set-ExecutionPolicy -Scope CurrentUser -ExecutionPolicy RemoteSigned

If the script was downloaded from the Internet, unblock it first:

powershell

  Unblock-File .\script.ps1
  • Check the current policy: Get-ExecutionPolicy -List
  • Managed computers: if the policy is enforced by Group Policy (GPO), the commands above may be ignored. Contact your IT administrator, or open a ticket with Need4Viz Support.

Please Wait!

Please wait... it will take a second!