Search

How to run a program or app as administrator

In Windows Operating Systems, some tasks which are critical for the Operating System to run, can be performed only by Administrators. Same rule is applicable for Windows Server 2022 also. A normal Windows user cannot run programs, or run commands from PowerShell, which can cause system wide effects.

Windows User Access Control (UAC) is one of the important security features in Windows, which prevents unauthorized changes to the Operating System, its files or configuration by unauthorized users.

In this example, I want to configure an IPv4 address to Windows Server 2022. Changing IPv4 address by an unauthorized user can cause serious negative implications to the Operating System, or its users. Changing IP address requires administrative level permissions in Windows Server 2022. A normal Windows user cannot perform this task.

To understand the concept of Windows User Access Control (UAC), please refer below images. Below image shows a PowerShell console, which shows current user as "jajish", who is not an administrator. The command used to find the current logged-in user is "whoami".

whoami-powershell.jpg

Now, the user "jajish" (who is not an administrator) is trying to run a PowerShell cmdlet to configure an IPv4 address. The PowerShell cmdlet to configure a new IPv4 address is shown below.

 New-NetIPAddress -InterfaceIndex 3 -IPAddress 192.168.10.203 -PrefixLength 24 -DefaultGateway 192.168.10.1

 

run-command-which-need-elevated-permission.jpg

 

Following image shows that PowerShell displaying an error, showing that, the operation is not permitted.

permission-denied-error.jpg

Now, let us try to run PowerShell as local Administrator, and then run the same PowerShell cmdlet.

How to run a program as administrator from Desktop short cut

To run a program as Administrator from Desktop, first create a short cut for the program at Desktop, right-click the short cut, and click "Run as administrator" from the context menu, as shown below.

runas-administrator-from-desktop-context-menu.jpg

 

Now enter the password of the user "administrator", when prompted. Click "Yes" button after entering the password.

runas-administrator-from-desktop-uac.jpg

 

A new PowerShell window is opened as user "administrator". You can again check who is the current user, bye running "whoami" command.

whoami-powershell-administrator.jpg

 

Now, again run the above permission denied "New-NetIPAddress" cmdlet, which required elevated permission. You can see that the cmdlet executed successfully as user "administrator".

 

command-running-without-error-as-administrator.jpg

 

How to use Start-Process cmdlet to run a program as administrator

You may also use "Start-Process" PowerShell cmdlet to run a program as administrator. Use below command to run a program as administrator, using "Start-Process" PowerShell cmdlet.

 Start-Process -FilePath C:\Windows\System32\cmd.exe -Verb runasuser

 

Refer following screenshot to understand the "Start-Process" PowerShell cmdlet more clearly. In this example, I am trying to run command prompt (cmd.exe), which is located in "C:\Windows\System32\" folder as a different user (administrator).

start-process-powershell-cmdlet.jpg

Now the Windows User Access Control (UAC), will prompt for the user id and password. Enter administrator user id and its password, as shown below. Click "OK" button to run the program as administrator.

start-process-powershell-cmdlet-uac.jpg

 

You can see that the command prompt program (cmd.exe) is run as user "administrator", as shown below.

cmd-terminial-opened-as-administrator.jpg

 

How to run a program as administrator from Windows Taskbar Search Box

You may run a program as administrator from Windows Taskbar Search Box. To run a program as administrator from Windows Taskbar Search Box, just search for the program from Search box, then right-click the search result and select "Run as administrator" from the context menu. Please refer below image.

run-program-as-administrator-search.jpg

 

How to run a program as administrator from Windows Run box

Another way to run a program as administrator is to run it from Windows "Run box". You can open Windows run box by right-clicking Windows start menu button, and then by clicking "Run" from the context menu. You can also open "Run box" by pressing Windows key + R key together from Windows Desktop.

Once the Windows "Run box" is open, type-in the program to run, and then hit Control + Shift + Enter keys together.

run-program-as-administrator-runbox.jpg

 

Windows User Access Control (UAC) will prompt you to enter administrator password. Type-in the administrator password, to run the program as administrator.

runas-administrator-from-desktop-uac.jpg

Written by Jajish Thomas.
Last updated on 20th May, 2022.

 

Related Tutorials
Introduction to Windows Server 2022
New features of Windows Server 2022
Hardware requirements for Windows Server
Different editions of Windows Server 2022
Difference between Server Core and Server with Desktop experience (GUI)
How to install Windows 2022 Server
How to use search functionality in Windows Server 2022
How to hide or unhide search box
How to add This PC icon to desktop in windows 2022
How to add Network icon to desktop in windows 2022
How to rename computer name in Windows 2022
How to rename computer name using PowerShell
How to configure IPv4 Address in Windows 2022
How to configure IPv6 Address in Windows 2022
How to configure IPv4 address Windows 2022 using PowerShell
How to configure IPv6 address Windows 2022 using PowerShell
How to shut down or restart Windows 2022
How to sign out from Windows Server 2022
How to run a program or app as administrator