Как запустить windows powershell с параметром запуск от имени администратора

Quick Tips

  • Utilize the search bar. Hit the Windows key + S > type PowerShell > right-click the result > select Run as administrator.
  • Press Win + R > type powershell > hold Ctrl + Shift + Enter to launch with admin rights.
  • Need another way? Press the Windows key + X and select Terminal (Admin).

Method 1. Using Windows Search

Step 1: Press the Windows key and type PowerShell in the search box.

Step 2: Click on Run as Administrator from the right pane.

Step 3: You will get a UAC prompt asking for your consent; click Yes.

Click on ‘Run as Administrator'

That’s it. The PowerShell will open as administrator. If you don’t want to use the Windows Search feature to find and open PowerShell, you can do the same with the help of the Windows context menu. Keep reading.

Method 2. Using WinX

Step 1: Press the Windows key + X on your keyboard.

Step 2: From the context menu, select Terminal (Admin).

Step 3: In the UAC prompt, click Yes.

select Terminal (Admin)

There you go. You have launched PowerShell in administrator mode. If you landed on some Command Prompt or in any other terminal, click on the Chevron (arrow) icon at the top and select PowerShell.

We will be using Windows Tools to execute this method.

Step 1: Press the Windows key on your keyboard > click on All apps.

click on All apps

Step 2: Scroll down and click on Windows Tools.

click on Windows Tools

Step 3: In the Windows Tools window, scroll down and right-click on Windows PowerShell.

Step 4: From the context menu, select Run as administrator.

go to Windows PowerShell

Step 5: In the prompt, click Yes.

There you go. You can now work on PowerShell with administrator privileges. If you want to know another way, jump to the next method. 

Method 4. Using Task Manager

Step 1: Press Ctrl + Shift + Esc on your keyboard to open Task Manager.

Step 2: Click on the Run new task button. It will open a Create new task dialog box.

Click on the ‘Run new task’ button

Step 3: Type PowerShell in the text field > check the box for Create this task with administrative privileges > click OK.

Type PowerShell in the text field

There you have it. It will open PowerShell with administrative privileges without any complications.

Method 5. Using the Run Command Box

Step 1: Press the Windows key + R on your keyboard to open the Run dialog box. 

Step 2: Type PowerShell > click OK. This will open Windows PowerShell with the rights of the current user. 

Type PowerShell

Step 3: To switch from normal (current user) mode to administrator mode, type the below command and press Enter.

Start-Process powershell -Verb runAs

Step 4: In the UAC prompt, click Yes.

To switch from normal mode to administrator mode

Method 6. Using CMD

Step 1: Press the Windows key > type Command Prompt > click Run as administrator. In the prompt, click Yes.

type Command Prompt

Step 2: In the Command Prompt window, type PowerShell > press Enter.

type PowerShell

FAQs

1. Does Windows PowerShell run in administrator mode by default?

Windows PowerShell does not run in administrator mode by default. When you launch PowerShell, it runs with the permissions of the currently logged-in user.

2. How do I know if PowerShell is running as an administrator?

There are several ways to determine if PowerShell is running as an administrator. One is to check the PowerShell window title or the PowerShell execution policy. Another is to check the user account control (UAC) prompt.

Was this helpful?

Thanks for your feedback!

The article above may contain affiliate links which help support Guiding Tech. The content remains unbiased and authentic and will never affect our editorial integrity.

Whether you’re just starting out with PowerShell or you already know how to run commands, there are times when you must use PowerShell to ‘run as administrator’ Why? Because sometimes, any activity you do inside of PowerShell will require elevated privileges.

In this tutorial, you’re going to learn just about every way possible to run PowerShell as administrator from the perspective of an end-user, a command-line junkie, or an IT admin!

This tutorial has many sections each showcasing how to run PowerShell as administrator. Feel free to click on whichever method you prefer in the Table of Contents.

Prerequisites

This article will be a hands-on tutorial. If you’d like to follow along, please be sure you have:

  • A Windows 10 PC – Although Windows 10 was used as an example for this article, most of the methods provided will work with Windows 7+.
  • An account with administrator privileges. If you don’t already have one, learn how to create one here.
  • PowerShell – Most of these methods will work with Windows PowerShell 5.1 or PowerShell 7.

Running PowerShell as Administrator with a Right-Click

One of the simplest ways to run PowerShell as administrator is with a right-click. There are a few different areas where you can right click on PowerShell and run it. Let’s run through them.

Using the Search Bar

The Search Bar is practically one of the easiest ways to run most of the programs installed on your computer. It’s also an easy way to run any program as administrator, including PowerShell.

To run PowerShell, specifically, as administrator from the search bar:

  1. Click on the search box at the taskbar and type powershell. This action will bring up the PowerShell edition of your preference.
  2. Look for Windows PowerShell or just PowerShell, if using PowerShell Core, from the search result.
  3. Right-click on the menu item and select Run as administrator.

You can see these steps demonstrated in the screenshot below.

Runnning PowerShell Using the Search Bar

Runnning PowerShell Using the Search Bar

If you pin a program to the start menu or taskbar, you can also right-click on the menu item there as well. With this method, Windows 10 creates a shortcut for PowerShell that is more accessible to you at the start menu or the taskbar.

To run PowerShell as administrator on a pinned item:

  1. Find the PowerShell icon in the search box again.
  2. Right-click on the PowerShell icon and select Pin to Start or Pin to Taskbar.
Pinning PowerShell to Start Menu or Taskbar

Pinning PowerShell to Start Menu or Taskbar
  1. Click on the Start button
  2. Look for Windows PowerShell (or PowerShell Core) on the right side of the Start Menu.
  3. Right-click on the menu item and choose Run as administrator.
Running PowerShell From The Start Menu

Running PowerShell From The Start Menu

Running PowerShell as Administrator Using File Explorer

Are you in Windows’ File Explorer, you can fire up PowerShell as administrator there too!

  1. Open up File Explorer by using Win Key + E shortcut keys or by simply clicking the icon at the taskbar as you can see on the screenshot below.
Open File Explorer From The Taskbar

Open File Explorer From The Taskbar

2. Once in File Explorer, click on File → Open Windows PowerShell → Open Windows PowerShell as administrator as shown below.

Run PowerShell From File Menu in File Explorer

Run PowerShell From File Menu in File Explorer

Using the PowerShell Executable

Whether you’re using a 32-bit or 64-bit operating system, you can run PowerShell as administrator from its respective location.

  1. In File Explorer, navigate to one of the folders below.
    • For 32-bit OS: C:\Windows\System32\WindowsPowerShell\v1.0
    • For 64-bit OS: C:\Windows\SysWOW64\WindowsPowerShell\v1.0
  2. Find the powershell.exe file.
  3. Right-click on powershel.exe and select Run as Adminstrator.
Run PowerShell as Administrator From a Folder

Run PowerShell as Administrator From a Folder

Creating a Shortcut for PowerShell on the Desktop

If you’d like an easy way to invoke PowerShell, you can also create a Windows shortcut for it.

  1. Once you’ve got the Create Shortcut process started, provide the path to the PowerShell executable. For Windows PowerShell, that path is:
  • For 32-bit OS: C:\Windows\SysWOW64\WindowsPowerShell\v1.0\powershell.exe
  • For 64-bit OS: C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe
Proceed Creating The Shortcut

Proceed Creating The Shortcut

2. Provide the shortcut a handy name (PowerShell Admin for example).

Name The Shortcut For PowerShell

Name The Shortcut For PowerShell

3. Find the shortcut you just created and right-click on it and choose Properties as shown below.

Accessing PowerShell's Shortcut Properties

Accessing PowerShell’s Shortcut Properties

4. Click on Shortcut tab and then on the Advanced button and the Advanced Properties window will pop-up.

PowerShell’s Shortcut Properties

5. In the Advanced Properties window, select the Run as administrator checkbox and click OK.

Set PowerShell to Run as Administrator

6. Back to the Shortcut Properties, click OK to apply the changes and you’re all set.

Another way to easily access PowerShell is via the Win-X menu as shown in the following screenshot. This menu was never given an official name but was widely referred to as Win-X (or power user menu) as the shortcut to access it is Win Key + X.

Once the menu is up, simply click on Windows PowerShell (Admin) and you’re off to th races.

Running PowerShell via WinX Menu

Running PowerShell via WinX Menu

Using the Run Command Window

The Run Command Window is a powerful tool that lets you run programs without searching for them using the SearchBar, Start Menu or File Explorer. To run PowerShell as administrator via the Run command window:

  1. Press Win Key + R. A a small window will pop up as shown in the screenshot below.
  2. Type in powershell and press Ctrl+Shift+Enter or press and hold Ctrl+Shift.
  3. Click OK to make PowerShell run as administrator.
Run Command Window

You’re now running PowerShell as administrator.

Using Task Manager

Task Manager is a tool that lets you monitor or end a process of the programs and services that are currently running on your computer. You can also use it to execute a task such as running PowerShell as administrator manually.

To run PowerShell as administrator via the task manager:

  1. Open the Task Manager by pressing Ctrl+Shift+Esc keys on your keyboard or as you see in the screenshot below

You can alternatively right-click on the Task Bar and select Task Manager to bring up Task Manager.

Run Task Manager

2. Once Task Manager opens, go up to File and click on Run new task as shown below.

Run New Task in Task Manager

Run New Task in Task Manager

3. You should then see a window pop up that looks similar to the Run window described earlier.

4. Type in powershell ensuring you also check the Create this task with administrative privileges checkbox and click OK to make PowerShell run as administrator.

Running PowerShell as Administrator with the Command Line

If you regularly find yourself on the command line, don’t fret, you can run PowerShell as administrator there too!

If you already have cmd. exe open running as adminstrator using the same techniques described in this article, you can simply run start powershell and it will be running as adminstrator.

If you’re running a command prompt not as administrator yet, that’s not a problem. Invoke the Start-Process cmdlet with PowerShell from cmd. exe using the -Verb runas parameter.

powershell Start-Process powershell -Verb runAs

If you’re already in a PowerShell window, you can run Start-Process powershell -Verb runas directly to open a new PowerShell instance running as administrator

Creating a Batch File to Run PowerShell as Administrator

So you now know how to invoke PowerShell as administrator from a command prompt. If you already know how to do that, you can create a batch file to automate it!

Open up your favorite text editor, paste in the following line and save the file as PowerShell as admin.bat anywhere you’d like.

Powershell.exe -Command "& {Start-Process Powershell.exe -Verb RunAs}"

Run the batch file and you’ll notice up comes a PowerShell window running as administrator!

Creating a Scheduled Task to Run PowerShell as Administrator

Task Scheduler is a built-in app on Windows 10 that lets you virtually run automated tasks. Hence, you can also use it to create a task that runs PowerShell as administrator each time you logon to your computer, for example.

Start up the Create Taskbox and specify the file to run as one of the below:

  • For 32-bit OS: C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe
  • For 64-bit OS: C:\Windows\SysWOW64\WindowsPowerShell\v1.0\powershell.exe

In the Create Task windows, provide the values to all of the menu items shown below ensuring the Run with highest privileges checkbox is checked.

Enable Run with Highest Privileges Option

Enable Run with Highest Privileges Option

Now when the scheduled task is invoked, it will execute PowerShell as administrator!

Further Reading

  • PowerShell Objects, Properties and Methods
  • How to Set Up and Manage Scheduled Tasks with PowerShell

Last Updated :
01 Dec, 2023

Windows Powershell is a powerful command-line shell and scripting language devised for administrators and professionals. PowerShell with administrative privileges in Windows 11 makes it possible to carry out tasks with superior permissions. This article will discuss several ways of opening Windows PowerShell as admin.

How-to-Open-Windows-PowerShell-as-an-Admin-in-Windows-11

What is Windows PowerShell?

The Windows PowerShell is a Command Line Interface and Scripting Language based on the .NET framework. Windows is an important tool that offers an active command line interface for automation of jobs and configuration management. PowerShell can run administrative commands and as such, provide administrator access.

Method 1: Open Windows PowerShell as an Administrator Using Win + X

Step 1: To open the quick access menu, right-click on Start or use the keyboard shortcut Win + X.

Step 2: Then, from the context menu, select «Terminal (Admin)».

Administrator-Using-Win--X

Step 3: In user account control click on «Yes«

Method 2: Run PowerShell Script as Admin from Start Menu

Step 1: Click on the start button, then the search box, and type «Windows tools».

Step 2: Then, Right-click on «Windows PowerShell» from the list.

Step 3: Choose «Run as administrator

Windows-PowerShell-as-an-Administrator-From-the-Start-Menu

Step 4: In user account control click on «Yes«

Method 3: Open PowerShell as Admin Using Windows Search

Step 1: Type «Windows PowerShell» in the Windows Search bar.

Step 2: Choose «Run as administrator» from the context menu

How-to-Open-PowerShell-as-Admin-Using-Windows-Search

Step 3: In user account control click on «Yes«

Method 4: Run Windows PowerShell Using Task Manager

Step 1: Type “Task Manager” in the search bar or press Ctrl + Shift + Esc to open Task Manager.

Step 2: Choose «Run new task.»

Step 3: Select Powershell, and tick administrative privilege.

How-to-Run-Windows-PowerShell-Using-Task-Manager

Method 5: Open PowerShell as Admin Using Run Dialog

Step 1: Press Win + R to open the Run dialog.

Step 2: Type «PowerShelland » and press Ctrl + Shift + Enter to run as administrator. Do not click on OK button

How-to-Open-PowerShell-as-Admin-Using-Run-Dialog

Step 3: In user account control click on «Yes«

Method 6: Run Windows PowerShell as Admin from CMD

Step 1: Open Command Prompt as an administrator.

How-to-Run-PowerShell-as-Admin-from-CMD

Step 2: In user account control click on «Yes«

Step 3: Type

powershell Start-Process powershell -Verb runAs

How-to-Run-PowerShell-as-Admin-from-CMD-1

Method 7: Open PowerShell as Admin Using Windows File Explorer

Step 1: Open file explores by using the shortcut Win + E or type «File Explorer» on search bar

Step 2: Type the command in the File Explorer address bar and press Enter.

C:\Windows\System32\WindowsPowerShell\v1.0\

Step 3: Right click on Powershell then click on «run as administrator».

How-to-Open-PowerShell-as-Admin-Using-Windows-File-Explorer

Step 4: In user account control click on «Yes»

Method 8: Open PowerShell as Admin Using Control Panel

Step 1: Open the Control Panel.

Step 2: Go to «System and Security» > «Windows Tools.»

How-to-Open-PowerShell-as-Admin-Using-Control-Panel

Step 3: Right-click on «Windows PowerShell ISE (x86)» or «Windows PowerShell» with administrative privileges.

Step 4: In user account control click on «Yes«

Method 9: Open PowerShell as Admin With a Desktop Shortcut

Step 1: Right-click on the desktop.

Step 2: Choose «New» > «Shortcut

How-to-Open-PowerShell-as-Admin-With-a-Desktop-Shortcut

Step 3: Enter «powershell.exe» as the location.

Step 4: Click «Next» and give your shortcut a name.

Step 5: Right-click on the shortcut, go to «Properties,» and under the «Shortcut» tab, click «Advanced» and check «Run as administrator.»

How-to-Open-PowerShell-as-Admin-With-a-Desktop-Shortcut--1

Conclusion

There are different ways to launch Windows PowerShell with administrative rights in Windows 11 such that you may choose what best suits you. You can use different approaches through which the PowerShell is executed with its administrative access. These means include the use of keyboard shortcuts and the Start Menu among others since it’s an elevated command used in system-level tasks. Adopt these processes within your workflow to simplify your administrative duties in Microsoft Windows 11.

Also Read

  • How to Change Your User Name on Windows 11?
  • How To Merge Folders in Windows?
  • How to Disable Background Apps in Windows 11?
  • How to Clear the Windows Command Prompt Screen?

run powershell as administrator

Like Command Prompt, Windows PowerShell is a command-line window designed in Windows, which is generally for system advanced administration, IT professionals and developers. Actually, Windows PowerShell is more powerful but less known than Command Prompt. In our previous post, we showed how to open Command Prompt as an administrator in Windows 10. Now in this post, we will show five ways to run PowerShell as an administrator in Windows 10.

  • Way 1: from start menu
  • Way 2: from Win + X menu
  • Way 3: from the command prompt
  • Way 4: from File Explorer
  • Way 5: from task manager
  • Way 6: from the Run dialog

Way 1: Run PowerShell as administrator from Start menu search box

Step 1: Bring up the Windows 10 Start menu.

Step 2: Type powershell. In the search result, right click on the Windows PowerShell app and select Run as administrator.

Way 2: Run PowerShell as admin from Win + X menu

Either Command Prompt or Windows PowerShell has usually included in Win + X menu.

Press Win + X keyboard shortcut to bring up Win + X menu. Then from the menu click Windows PowerShell (Admin).

Way 3: Run PowerShell as administrator from an elevated CMD

Step 1: Open Windows 10 Command Prompt as administrator.

Step 2: Type powershell and hit Enter. Then the command prompt will turn to Windows PowerShell.

Run powershell from command prompt

Way 4: Run PowerShell as administrator from File Explorer

Step 1: Open File Explorer in Windows 10.

Step 2: Navigate to C:\Windows\system32\WindowsPowerShell\v1.0\powershell.exe. Then right-click on the powershell.exe file and select Run as administrator.

Right-click on powershell.exe

Way 5: Run PowerShell as administrator from Task Manager

Step 1: Open Windows 10 task manager.

Step 2: Click on More details in the lower left corner to display the full screen of task manager.

Step 3: Click File > Run new task.

Step 4: In the Create new task dialog box, type powershell, check the box next to Create this task with administrative privileges and then click OK.

Create powershell task

Step 1: Bring up Run dialog box by pressing Win + R keys.

Step 2: Type powershell in the box and click OK.

Step 3: A normal Windows PowerShell will open as your current user. Type start –process powershell –verb runAs and hit “Enter” key. This will bring up an elevated PowerShell as an administrator.

Start administrative powershell

There are several ways to run PowerShell scripts as an administrator interactively and non-interactively — which is suitable for automation.

Running PowerShell as Administrator (Interactive)

An elevated PowerShell session is required to run PowerShell scripts as an administrator. Opening the elevated PowerShell console triggers the UAC prompt.

  1. Right-click the Start button or press Win+X on the keyboard to open the Power User Menu on Windows.
  2. Click Windows PowerShell (Admin) (replaced with Terminal (Admin) on Windows 11) to open the elevated PowerShell console;
    powershell run as administrator without prompt

  3. Confirm the elevation at the UAC prompt.
  4. Any command or PowerShell script that is run from this console will be run as an administrator.
  5. For example, to run a specific PS1 script file, change the directory and run:
    cd C:\PS
    
    .\my_script.ps1

    ps1 run as administrator

You can create a desktop shortcut that always runs an elevated interactive PowerShell console.

  1. Right-click anywhere on the desktop and click New → Shortcut.
  2. Type powershell.exe (Windows PowerShell) or pwsh.exe (PowerShell 7+) and click Next.
    run powershell script as administrator

  3. Type the shortcut name and click Finish.
  4. Open the shortcut properties and click Advanced. Check the “Run as administrator” box and save changes.
    run ps1 as admin

Every time you use the new shortcut to start PowerShell, it will run as an administrator.

To run PowerShell script file as an administrator from the command prompt or from a BAT/CMD script, use the following command:

powershell -NoProfile -ExecutionPolicy Bypass -Command "Start-Process -Verb RunAs powershell -ArgumentList '-NoProfile -ExecutionPolicy Bypass -File C:\ps\my_script.ps1'

Note. The Bypass parameter is used to ignore the current settings of the PowerShell execution policy.

run powershell command as administrator without prompt

How to Check if a PowerShell Script is Running as Administrator

When you run a PowerShell script, you may need to check that it is running in elevated mode. Add the following block code at the beginning of the script to indicate that this script is being run as an administrator:

if (([System.Security.Principal.WindowsPrincipal] [System.Security.Principal.WindowsIdentity]::GetCurrent()).IsInRole([System.Security.Principal.WindowsBuiltInRole]::Administrator)){

"Run as admin - SUCCESSFUL"

}

else {

"Run as admin - FAILED"

}

Start-Sleep -Seconds 10

Run PowerShell Script as Administrator Without UAC Confirmation

In all of the cases described above, running the PowerShell script as an administrator requires UAC elevation confirmation. To run a PowerShell script as an administrator without the UAC prompt, you must create a special scheduled task with Highest Privileges option enabled.

  1. Open the Task Scheduler (taskschd.msc) and click “Create a task.”
    powershell run script as administrator

  2. Under the General tab, configure the following:
    • The name is RunMeAsAdmin.
    • Select Run only when user is logged on.
    • Check Run with highest privileges.

powershell script run as administrator

  1. Switch to the Actions tab and click New.
  2. In the New Action window:
    • Type powershell.exe for Windows PowerShell or pwsh.exe for PowerShell Core in the “Program/script” box.
    • Type -NoProfile -ExecutionPolicy Bypass -File C:\ps\my_script.ps1 inside the “Add arguments”.
      powershell elevate to admin in script

    • Click OK to close the New Action window.
  3. Click OK to save the new task.
  4. Once the task is created, select it from the list and click Run in the Actions pane. This will run your PowerShell script elevated without UAC prompt.
    run ps1 script as administrator

  5. Or you can trigger it from PowerShell by running the below command:
    Start-ScheduledTask -TaskName <task name>

    run powershell script as admin

This approach allows PowerShell scripts to run in the elevated non-interactive mode without triggering the UAC prompt.

Понравилась статья? Поделить с друзьями:
0 0 голоса
Рейтинг статьи
Подписаться
Уведомить о
guest

0 комментариев
Старые
Новые Популярные
Межтекстовые Отзывы
Посмотреть все комментарии
  • Как удалить лишние приложения на windows 10
  • Драйвер hp laserjet 2200 series pcl 5 драйвер windows
  • Как открыть общий доступ к диску в windows xp по локальной сети
  • Добавить символ в таблицу символов windows
  • Как активировать повер поинт бесплатно для windows 10