Windows execute as administrator

How do I log on as an administrator?

An administrator is someone who can make changes on a computer that will affect other users of the computer. Administrators can change security settings, install software and hardware, access all files on the computer, and make changes to other user accounts. To log on as an administrator, you need to have a user account on the computer with an Administrator account type.

If you are not sure if the account that you have on the computer is an administrator account, you can check the account type after you have logged on. The steps that you should follow will vary, depending on whether your computer is on a domain or a workgroup.

Type the user name and password for your account in the Welcome screen.

Open User Accounts by clicking the Start button , clicking Control Panel, clicking User Accounts, clicking User Accounts, and then clicking Manage User Accounts . If you’re prompted for an administrator password or confirmation, type the password or provide confirmation.

Your user name is highlighted and your account type is shown in the Group column.

Type the user name and password for your account in the Welcome screen.

Open User Accounts by clicking the Start button , clicking Control Panel, clicking User Accounts and Family Safety, clicking User Accounts, and then clicking Manage another account . If you’re prompted for an administrator password or confirmation, type the password or provide confirmation.

Your account type is displayed below your user name.

If your account type is Administrator, then you are currently logged on as an administrator.

If your account type is not Administrator, then you cannot log on as an administrator unless you know the user name password for another account on the computer that is an administrator. If you are not an administrator, you can ask an administrator to change your account type.

question

Run bat file as administrator

Could you please help me to execute a bat file silently as an administrator. Is it possible to add run as administrator option in a bat file. I tried the below command, but its not worked for me.

msiexec.exe /i «F:\Test\DesktopCentral_Agent.msi» /quiet /norestart

I am getting this error below.

The installer has insufficient privileges to access this directory: C:\Program Files (x86)\DesktopCentral_Agent. The installation cannot continue. Log on as administrator or contact your system administrator.

5 Answers

Based on the question, I am assuming that the user who is running the bat file is a standard user and not an administrator and does not know the administrator password. Is that a correct assumption?

If so, is this what you are looking for?

There is no magic switch to allow a standard user to gain administrator access without somehow providing administrator credentials. That would be a security hole. Of course if you save the credentials of the administrator account as that page describes, that may also be a security hole.

There may be other alternatives (task scheduler) that you could use, but you would need to explain more about what you are trying to accomplish.

User has admin rights and able to execute the command. But its need to run as admin to execute the command properly, otherwise it wont work and shows the error mentioned below

«The installer has insufficient privileges to access this directory: C:\Program Files (x86)\DesktopCentral_Agent. The installation cannot continue. Log on as administrator or contact your system administrator.»

Refer to the link below:

https://social.technet.microsoft.com/Forums/en-US/53ff7268-a82c-4fdb-92b1-6e5b5c206826/installation-failed-in-windows-server-2016?forum=ws2016
Note: This is a third-party link and we do not have any guarantees on this website. And Microsoft does not make any guarantees about the content.

Try this bat file. If the user right clicks the bat file and selects «Run as Administrator», it will detect that it is elevated and will call the installer. If it is not elevated it will use powershell to invoke the UAC prompt and run the installer.

Just to check if the above reply could be of help, if yes, you may mark useful reply as answer, if not, welcome to feedback.

Читайте также:  Ping ��� ip linux

question details

2 people are following this question.

Using ‘Run As’ in Windows

Standard users can run privileged programs with this trick

Nick Dolding/Photodisc/Getty Images

Running a program as an administrator is a common task in Windows. You need to have admin rights when you install programs, edit certain files, etc. You can easily do this with the «run as» feature.

To run a task as an administrator is, clearly, only useful if you’re not already an admin user. If you’re logged in to Windows as a regular, standard user, you can choose to open something as a different user that does have administrative rights so that you can avoid having to log out and then log back in as the administrator only to perform one or two tasks.

How to Use ‘Run As’ in Windows 10, 8, or 7

The «run as» option in Windows doesn’t work the exact same way in every version of Windows. Newer Windows versions—Windows 10, Windows 8, and Windows 7—require different steps than previous versions.

If you’re using Windows 10, 8, or 7, follow these steps:

Hold down the Shift key and then right-click the file.

Choose Run as different user from the context menu.

Enter the User name and Password for the user whose credentials should be used to run the program. If the user is on a domain, the correct syntax is to type the domain first and then the username, like this: domain\username.

How to Use ‘Run As’ in Windows Vista

Windows Vista is a bit different than the other versions of Windows. You have to either use the program mentioned in the tip below or edit some settings in the Group Policy Editor in order to open programs as another user.

Search for gpedit.msc in the Start menu and then open gpedit (Local Group Policy Editor) when you see it in the list.

Navigate to Local Computer Policy > Windows Settings > Security Settings > Local Policies > Security Options.

Double-click User Account Control: Behavior of the elevation prompt for administrators in Admin Approval Mode.

Change the drop-down option to be Prompt for credentials.

Click OK to save and exit that window. You can also close down the Local Group Policy Editor window.

Now, when you double-click an executable file, you’ll be asked to choose a user account from the list to access the file as the other user.

For Windows XP Users

Windows XP users just need to right-click the file to see the «run as» option.

Right-click the file and choose Run as. from the menu.

Choose the radio button next to The following user.

Type the user you want to access the file as or choose it from the drop-down menu.

Enter the user’s password in the Password: field.

Press OK to open the file.

To use the «run as» option in any version of Windows without using the right-click option, download the ShellRunas program from Microsoft. Drag-and-drop executable files directly onto the ShellRunas program file. When you do this, you’ll immediately be prompted to provide alternate credentials.

You can also use «run as» from the command line via Command Prompt. This is how the command needs to be set up, where all you need to change is the bold text:

For example, you’d execute this command to run a downloaded file (PAssist_Std.exe) as another user (jfisher):

You’ll be asked for the user’s password right there in the Command Prompt window and then the program will open normally but with that user’s credentials.

You do not need to do anything to «turn off» this kind of access. Only the program you execute using «run as» will run using the account you choose. Once the program is closed down, the user-specific access is terminated.

Why Would You Do This?

Security administrators and experts often preach that users should use the least-privileged user account they can, without adversely impacting their productivity, for day-to-day tasks and activities. All-powerful accounts such as the Administrator account in Microsoft Windows should be reserved for only when they are needed.

Part of the reason is so that you don’t accidentally access or modify files or system configurations that you shouldn’t be dealing with. The other is that viruses, Trojans, and other malware often execute using the access rights and privileges of the account being used. If you’re logged in as the administrator, a virus or other malware infection will be able to execute virtually anything with super-level rights on the computer. Logging in as a normal, more restricted user can help secure and protect your system.

However, it can be frustrating to have to log out and log back in as an administrator to install a program or modify a system configuration, and then log out again and log back in as a regular user. Thankfully, Microsoft includes the «run as» feature which allows you to run programs using a different username and password than the ones used by the currently logged in user.

13 ways to use “Run as administrator” in Windows 10

In Windows 10, knowing how to run programs as administrator is very important. By default, apps and games in Windows 10 run without administrator permissions, to prevent unauthorized changes to your system. However, there are times when some programs require administrator permissions to work properly or to run specific commands. Windows 10 offers you the ability to run programs as admin without having to disable anything. Here are all the methods to use “Run as administrator” on any desktop app in Windows 10:

Читайте также:  Zfs on linux centos 8

First things first: About UAC and Run as administrator

In early versions of Windows, applications had system-wide privileges, which was a security risk. All of Microsoft’s operating systems from Windows Vista onward, including Windows 10, include UAC or User Account Control, a security feature that prevents unauthorized changes to the operating system. Trying to run an application as administrator is one of the changes that require administrative privileges. Before the selected program is launched, a UAC prompt is triggered, asking for permission. If you run the application from an account without administrator permissions, the UAC prompt asks you to enter an administrator password. Without the admin password, the program does not launch.

In Windows 10, you can only run a program with administrator permissions if it is a desktop app. Some of these applications, like security software, cannot run correctly without having administrative permissions. Windows apps that are installed from the Microsoft Store cannot be run with administrative privileges in Windows 10. Furthermore, they have the same level of permissions as a normal user account, so they are not allowed to make changes to advanced system settings or the Windows Registry.

You can learn more about the difference between desktop apps and UWP apps and figure out which ones you can “Run as administrator” by reading What is a Windows app? How is it different from a desktop app or a program?.

1. Run a program as admin from the contextual menu of its Start Menu shortcut or tile

In Windows 10, you can launch a program with administrative permissions by using the contextual menu of its Start Menu shortcut. First, open the Start Menu. Then, find the shortcut of the program you want to launch in the All apps list, and right-click or press-and-hold on it to open a contextual menu. Click, tap, or hover over the More option, and then click or tap on “Run as administrator.

If you have a tile for your desktop app available in the Start Menu, right-click or press-and-hold on it to open a contextual menu. Access More and then click or tap on “Run as administrator.

2. Run as administrator using “Ctrl + Shift + Click” on its Start Menu shortcut or tile

Open the Start Menu and locate the shortcut of the program you want to launch as administrator. Hold down both the Ctrl and the Shift keys on your keyboard and then click or tap on that program’s shortcut.

You can also use the “Ctrl + Shift + Click/Tap” shortcut on an app’s Start Menu tile to run it with administrator permissions in Windows 10.

During our tests, this method did not work every time, so if that is the case for you, either try again or consider running the app as administrator another way.

3. Run a program as administrator from its desktop shortcut

Find the desktop shortcut for the program you want to run as admin or create one yourself. Then, right-click or press-and-hold on it to open a contextual menu. Click or tap on the “Run as administrator” option.

4. Run a desktop app as administrator from its taskbar shortcut

In Windows 10, you can also run a desktop app with administrator permissions from its taskbar shortcut. Right-click or press-and-hold on the shortcut, and then right-click or press-and-hold again on the program’s name. Then, from the menu that opens, choose “Run as administrator.”

You can also use the “Ctrl + Shift + Click/Tap” shortcut on an app’s taskbar shortcut to run it with administrator permissions in Windows 10.

5. Run a program as administrator from its right-click menu

Although easier to find, shortcuts are not the only way to run a program as administrator in Windows 10. You can perform the same action from the main executable file’s contextual menu.

Open File Explorer and find the desktop app’s executable. Right-click or press-and-hold on it to open the contextual menu, and then click or tap on “Run as administrator.

6. Use “Run as administrator” from File Explorer’s ribbon

Find the program’s main executable in File Explorer. Select it, and then click or tap on the Manage tab from the ribbon.

The option you need is displayed in the Run section of Application Tools. Click or tap on the upper half of the “Run as administrator” button to give the selected app admin permissions.

As an alternative, you can also press the lower half of the “Run as administrator” button and then click or tap on the “Run as administrator” option from the drop-down menu.

In the taskbar search field, type in the name of the program that needs to run with administrator permissions. Then, click or tap on the “Run as administrator” option displayed on the right side of the Search window.

Obviously, when you see the UAC prompt asking for permission to run the app as admin, click or tap Yes.

8. Run a program as administrator using “Ctrl + Shift + Enter” on its taskbar search result

Type the name of the program in your taskbar’s search field. If there are multiple results, use the arrow keys on your keyboard to highlight the program you want to run as administrator. Then, simultaneously press the Ctrl + Shift + Enter keys on your keyboard.

Читайте также:  Astra linux проверка целостности системы

9. Run a program as administrator from the Run window

Open the Run window and type in the name of the executable for the program you want to run as administrator. Then hold down the Ctrl and Shift keys on your keyboard and click or tap on OK.

Alternatively, after typing in the name of the program’s main executable, press the Ctrl + Shift + Enter keys on your keyboard at the same time.

10. Run as admin from the Task Manager

Another way to launch a program as administrator in Windows 10 is to start it using the Task Manager. To begin, open the Task Manager. Then, if it opens up in its compact view, click or tap on the More details button.

In the expanded Task Manager, open the File menu and click or tap on “Run new task.

This opens the “Create new task” window. You can use its Open field to enter the path to the program you want to launch as administrator, or you can click or tap on Browse to navigate to it. Then, make sure to check the “Create this task with administrative privileges.” option and click or tap on OK.

TIP: An advantage of using this method to launch programs as administrator is that you skip the UAC part of the process. That is because the app automatically inherits the permissions of the Task Manager – in our case, administrator permissions – so all you have to do is check the box to enable the option, as seen above. The option is missing if you only have standard user permissions on the device.

11. Run a desktop app as admin using the RunAs command in Command Prompt (CMD) or PowerShell

If the command line is your favorite way of asking your computer to do what you want, you can also access Command Prompt or PowerShell to run a program as administrator. Enter the following command in the CMD or PowerShell window, adjusting it to fit your needs:

runas /user:”your_computer_name\administrator_name”C:\path\program.exe

Replace your_computer_name with your computer’s name, administrator_name with the name of a user account that is an administrator on your system, and C:\path\program.exe with the complete path to the program that you want to run as administrator.

As seen in the image below, if you enter the command correctly, you are also asked to enter the administrator’s password. Then, press Enter on your keyboard once again.

TIP: Using this method to launch programs as administrators, you skip the UAC part of the process.

12. Always run a program with administrator permissions

To avoid constantly having to use the methods illustrated above on desktop apps accessed on a regular basis, you can set a program to always run with administrator permissions.

First, open File Explorer and find the main executable of the program you want to run. Right-click or press and hold on it to open the contextual menu. Then, click or tap on Properties.

In the Properties window, go to the Compatibility tab. At the bottom of the window, check the box next to the “Run this program as an administrator” option, and then click or tap on Apply or OK.

This setting is applied, and, from now on, the program always runs with administrator permissions. Follow the same steps if you want to disable the option. You can also edit the Properties of a program’s shortcut to avoid tampering with its main executable. To begin, right-click or press-and-hold on a program’s shortcut to access its contextual menu, and click or tap on Properties.

Then, in the shortcut’s Properties window, select the Shortcut tab. Click or tap on the Advanced button to open Advanced Properties.

In the Advanced Properties window, check the box next to “Run as administrator” and then click or tap OK.

Finally, you are returned to the Properties window, where you have to click or tap on OK or Apply, and you are done.

The settings are applied, and your program works with administrative permissions as long as you open it using the same shortcut. When you use the methods in this section, the UAC prompts you as soon as you try to launch the app.

13. Run a program with administrator permissions and without a UAC prompt

Using the Task Scheduler, you can run a program as administrator without being prompted by the UAC (User Account Control) every time. It is simple, and you don’t have to disable UAC, thus compromising Windows 10’s security. We put together a detailed step by step guide to help you: Use the Windows Task Scheduler to run apps without UAC prompts and admin rights.

Which method(s) do you plan to use?

In Windows 10, there are fewer apps that need to run with administrator permissions than in older versions of Windows. However, a few legitimate programs still require elevated privileges. The main thing to remember is that even if you are logged in with an administrator account, you regularly run apps as a standard user. This means that if you need to run a program that requires administrator permissions, you can just use one of the methods described above and then approve it in the UAC prompt. Which of the method(s) illustrated do you plan to use? Did you already use some of them? Let us know in a comment.

Оцените статью