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:
- Launch PowerShell as an administrator via the Start menu
- Launch PowerShell as an administrator via PowerShell
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:
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.