Skip to main content

Launch Program with Admin Privileges using an elevated command prompt

Running Control Panel Applets with administrative privileges.

A quick notes on how to launch a control panel applet from a user with no Admin rights.

Elevated command prompt, is running the command prompt with Administrative privileges.

In an Active Directory environment, it's quite a bad idea giving Domain Admin rights to any users or setting the domain user  account as a member of Local Administrator.

Why it is a bad idea? I guess  you know the downside of it.

Troubleshooting or doing some simple tasks  on AD  or domain environment, is quite a hassle.  If the active or current user does not have an Administrative privileges.

I bet if you like to do things, like installing or removing programs. It would be better if you will login with Administrator account, in such a way you can do things smoothly.

If you're not login as an Administrator then you have to bear the annoying pop up box that keep asking for an Admin password.

Well, of course there are a lot of ways to uninstall or remove a program  and avoiding all those annoying pop up boxes even though you're not login as admin.

Some commands does not run or requires an elevation to successfully run.

By typing:  "netsh winsock reset" on a command prompt that is not elevated, a message will be displayed "The requested operation requires an elevation".

Anyway, since these topic is about elevated command prompt.

So what's really good about the elevated command prompt and how we can make use of it.

If GUI or the Graphical User Interface can do a lot of things, there are more things you can do also in command prompt that GUI can't offer.

Let's go back to the above topic, on how we can uninstall or remove a program if the user does not have an admin rights.

How to do it?

Of course the easiest way is to switch user account or login as an admin, then puff solve the issue.

But what if the switch user account is disabled and the only option is to log off and login as another user but you're not able to log off because  there is an application that runs and can't just be close.

This is how an elevated command prompt comes to the rescue.

Let' s say  the user is just a domain user and you want to uninstall or remove a program, you can't just click on the Control Panel,  and select "Add or Remove Programs" or click on "Programs and Features". (settings on control panel will differ  base on Windows Version)

So Open an elevated command prompt (type the necessary credentials like: admin username and admin password), and you can run or launch a program with an Administrator privileges.

I'll take an example with Windows 7 "Programs and Features", to launch the control panel applet from an elevated command prompt type:

control  appwiz.cpl  (press enter)

After pressing enter the "Programs and Features" window will open with an Administrative privileges and even though the login user does not have an admin account since the program was launch with an elevation, you can remove or uninstall programs to your heart's content.

Likewise, let's say you have an MSI or EXE installer and you run it with elevation. The installation will just run smoothly.

How to do it? Let's assume that the elevated CMD window is already open and you want to install a particular MSI program.

The program is called example_program.msi and is located at C:\Downloads.

At cmd window, go to the Download folder by typing (don't include the quote):  "cd Downloads"
The  command prompt settings will change to C:\Downloads

Under the download folder type the name of the program or installer you want to run.

In our example it's called example_program.msi, so type the whole name including the filename extension and press enter.

So to run it will be: C:\Downloads\example_program.msi and press enter.

After pressing enter the program will run without prompting for any admin password, since it was launch on elevated cmd.

Before I forgot, how to run an elevated command prompt?

Go to "All Programs" go to "Accessories" if you see the "Command Prompt", right click on it and select "Run As Administrator".

So those are just some good reasons why running command prompt as admin is quite useful.


Hope it helps and simplify your tasks one day!!!

===============
Android app for kids:

https://play.google.com/store/apps/details?id=com.xmultiplication

Comments

  1. control appwiz.cpl from an elevated rights CMD window will not allow you to uninstall programs. I have been searching everywhere to find the answer to this.

    ReplyDelete
  2. control appwiz.cpl will not uninstall program, it will launch the add or remove program then from there you can uninstall program that you want.
    Provided the user has the rights to uninstall.

    ReplyDelete

Post a Comment

Popular posts from this blog

Notepad++ convert multiple lines to a single line and vice versa

Notepad++ is an awesome text editing tool, it can accept regex to process the text data. If the data is in a “.csv” format or comma separated values which is basically just a text file that can either be opened using a text editor, excel or even word. Notepad++ can process the contents of the file using regex. Example if the data has multiple rows or lines, and what is needed is to convert the whole lines of data into a single line. Notepad++ can easily do it using regex. However, if the data is on a single line and it needs to be converted into multiple lines or rows then regex can also be used for this case. Here’s an example on how to convert multiple rows or lines into a single line. Example data: Multiple rows, just a sample data. Press Ctrl+H, and  on "Find what" type: [\r\n]+ and on "Replace with" type with: , (white space) --white space is needed if need to have a space in between the data. See image below, "Regular Expression" must be se

WMIC get computer name

WMIC get computer model, manufacturer, computer name and  username. WMIC is a command-line tool and that can generate information about computer model, its manufacturer, its username and other informations depending on the parameters provided. Why would you need a command line tool if there’s a GUI to check? If you have 20 or 100 computers, or even more. It’s quite a big task just checking the GUI to check the computer model and username. If you have remote computers, you need to delegate someone in the remote office or location to check. Or you can just write a batch file or script to automate the task. Here’s the code below on how get computer model, manufacturer and the username. Open an elevated command prompt and type:     wmic computersystem get "Model","Manufacturer", "Name", "UserName" Just copy and paste the code above, the word “computersystem” does not need to be change to a computer name. A

How to check office version from command line

The are quite a few ways to check office version it can be done via registry, PowerShell or VBScript and of course, good old command line can also do it. Checking Windows office version whether it is Office 2010, Office, 2013, Office 2016 or other version is quite important to check compatibility of documents; or just a part of software inventory. For PowerShell this simple snippet can check the office version: $ol = New-Object -ComObject Excel.Application $ol . Version The command line option will tell you where’s the path located; the result will also tell whether office is 32-bit, 64-bit and of course the version of the office as well. Here’s the command that will check the office version and which program directory the file is located which will tell whether it’s 32-bit or 64-bit. Command to search for Excel.exe: DIR C:\ /s excel.exe | find   /i "Directory of"  Above command assumes that program files is on  C: drive. Sample Outpu