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

Copy a single file using robocopy

Copy a single file using robocopy from a local folder to a shared folder on the network.
A simple rule of thumb before any disaster strike, don't interchange the source and the destination.

If source and destination is mistakenly reverse, files might get overwritten. To avoid any loss of data do a test with a dummy file to ensure things work perfectly.
Robocopy [source][destination]   [file to be copied]
robocopy c:\local_c_folder  \\PC_network\shared_folder   file_to_be_copied_xx.txt
The command will be completed successfully provided the network access right has no issues.

Robocopy works quite good on large files. A simple copy or xcopy command will also work but the speed might vary.

However, if the file (ex. an ISO file) and is more than 4GB and the filesystem  of the thumbdrive or the storage is FAT system, then robocopy or any methods of copying will not work. Since FAT has a file size limitation of less than 3GB.

Robocopy is free it can be accessed from command line. No ne…

WMIC List printers

WMIC comes handy if you are a command line junkie.

To list printers via command line type:

wmic printer get name  = = = this will list all the printers installed on a workstation

To list the printer name and the port name of the printers, type this command:

wmic printer get name, portname

Type this command below to list the printer drivers:

wmic printer get name, drivername

To get the device id:

wmic printer get name, deviceid

You can deploy a batch file startup script to check which printer is installed on the computers and redirect the output to a shared folder.

PowerShell can also be used in conjunction with WMIC command:
http://quickbytesstuff.blogspot.sg/2015/11/powershell-list-printers-of-remote.html


To see more WMIC tips, click on WMIC label below.

Cheers!!!

Linux Android App cheat sheet:
https://play.google.com/store/apps/details?id=com.LinuxMobileKit

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 sample output below will be generated if the co…