Run PowerShell Script as Admin Without Restrictions

Running PowerShell scripts in Windows 11 often results in execution policy errors, especially when administrative privileges are required. This guide explains how to execute PowerShell scripts with full administrator privileges while bypassing execution policy restrictions using one-liner commands, elevated sessions, desktop shortcuts, and self-elevating script wrappers.

Method 1: Use the Bypass Parameter via Command Line

The most direct way to run a script without altering system-wide security settings is to use the -ExecutionPolicy Bypass argument from an elevated command-line interface.

  1. Press Win + S, type powershell, right-click Windows PowerShell (or Terminal), and select Run as administrator.
  2. Run the following command, replacing the path with the actual location of your script:
powershell.exe -NoProfile -ExecutionPolicy Bypass -File "C:\Path\To\YourScript.ps1"

Method 2: Bypass Policy Inside an Elevated Session

If you already have an elevated PowerShell session open, you can set the bypass scope strictly to the current process. This ensures system-level security policies remain intact after you close the window.

  1. Open PowerShell or Windows Terminal as Administrator.
  2. Set the policy for the current session:
Set-ExecutionPolicy -Scope Process -ExecutionPolicy Bypass -Force
  1. Execute your script:
& "C:\Path\To\YourScript.ps1"

Method 3: Create a “Run as Administrator” Shortcut

You can create a desktop shortcut that automatically requests administrator rights and bypasses the policy upon launching.

  1. Right-click on your Desktop and choose New > Shortcut.
  2. In the target field, enter:
powershell.exe -NoProfile -ExecutionPolicy Bypass -File "C:\Path\To\YourScript.ps1"
  1. Name the shortcut and click Finish.
  2. Right-click the newly created shortcut and select Properties.
  3. Go to the Shortcut tab, click Advanced…, check the Run as administrator box, and click OK.

Method 4: Add a Self-Elevating Header to the Script

To make the .ps1 file automatically elevate itself and bypass policies without manual intervention, place this block at the very top of your script:

if (-not ([Security.Principal.WindowsPrincipal][Security.Principal.WindowsIdentity]::GetCurrent()).IsInRole([Security.Principal.WindowsBuiltInRole]::Administrator)) {
    Start-Process powershell.exe -ArgumentList "-NoProfile -ExecutionPolicy Bypass -File `"$PSCommandPath`"" -Verb RunAs
    exit
}

# Your actual script code starts below:
Write-Host "Running with Administrator privileges and Bypassed policy!" -ForegroundColor Green

When executed, this script detects whether it has administrative privileges. If not, it launches a new elevated PowerShell process with the -ExecutionPolicy Bypass flag and closes the unprivileged instance.