Powershell

Running a command as Administrator Using PowerShell

PowerShell is the Windows utility used to perform various administrative tasks. It is made up of the .NET common language runtime (CLR). When you launch PowerShell without administrative privileges, it does not execute most of the commands and cannot perform administrative tasks. PowerShell does not launch as an administrator by default, and there are no options to do so. Even in the properties of PowerShell, there is no checkbox for “Run as administrator”, but there exist two major methods to do so.

This tutorial will walk through a procedure to run PowerShell commands as an administrator.

How to Run/Execute a Command as an Administrator From PowerShell?

Here are some of the methods to launch PowerShell as an Administrator:

Method 1: Launch PowerShell as an Administrator via the Start Menu

PowerShell can be easily launched with administrator privileges from the Start menu. For that reason, first of all, navigate to the Start menu, type, and search “PowerShell”. After that, click on “Run as Administrator”:

As you can see, PowerShell has been launched as an administrator. Now, you can execute any command that requires sudo privileges:

Method 2: Launch PowerShell as an Administrator via PowerShell

In case if you have already launched the PowerShell without administrator privileges, then execute the given “Start-Process” command to run a separate PowerShell as an administrator:

> Start-Process powershell -Verb runas

The below window confirms that PowerShell has been launched as an administrator:

Now, you can execute any command that requires sudo privileges.

Conclusion

To run a command as an administrator by using PowerShell, first open PowerShell as an administrator. For this purpose, there are two methods, the first is to go through the Start menu, and the second is to execute the “Start-Process” command in the PowerShell console itself. After that, you can execute the required commands in PowerShell. This post has provided several methods to run PowerShell as an administrator for executing the commands that require sudo privileges.

About the author

Muhammad Farhan

I am a Computer Science graduate and now a technical writer who loves to provide the easiest solutions to the most difficult problems related to Windows, Linux, and Web designing. My love for Computer Science emerges every day because of its ease in our everyday life.