15

We have Win7 machines on a domain that we'd like to open the "Programs and Features" control applet via the command line while a regular user is logged in.

Here's the catch: I know how to do this using runas from the command line BUT after "Programs and Features" opens, I don't truly have the ability to remove a program. I am told that I need to be an Admin to do so. Here are the commands I have tried:

runas /user:%computername%\administrator cmd.exe then in the new cmd window running: control appwiz.cpl

runas /user:%companydomain%\%domainadminacct% cmd.exe then in the new cmd window running: control appwiz.cpl

runas /user:%computername%\administrator cmd.exe then in the new cmd window running: rundll32.exe shell32.dll,Control_RunDLL appwiz.cpl

runas /user:%companydomain%\%domainadminacct% cmd.exe then in the new cmd window running: rundll32.exe shell32.dll,Control_RunDLL appwiz.cpl

I have also tried all of the above as one long line of code instead of launching a cmd.exe as Admin

As you can see, I have tried running the command using both a local admin account (Administrator) AND a domain admin account. I have also tried launching the runas command as one long command (opening the "programs and features") AND 1st launching a cmd.exe with admin rights and THEN launching the "Programs and Features" window. The result is the same: The "Programs and Features" windows opens but when I try to perform an uninstall, I am told I need Admin rights. Thus I am lead to believe that this instance of "Programs and Features" is not truly being run as an admin.

I am trying to avoid logging the regular user out. I am also aware that every program has its own uninstaller, I do not want to uninstall that way. I want to use the uninstaller in "Programs and Features". Any help is appreciated.

0
7

Is there any particular reason you're trying to do this from the command-line as opposed to built-in features available in the UI? Also, might there be a system policy that's preventing you from performing these operations?

Here's a suggestion using the UI:

  1. Open the Start Menu
  2. In the Search Bar, type appwiz.cpl.
  3. Wait for appwiz.cpl to appear in the search results. There should be only one entry at the top, under "Programs". It should have a document icon with some gears on it, and should be automatically highlighted.
  4. With appwiz.cpl highlighted in the search results, press CTRL+SHIFT+ENTER. This will force Windows to attempt executing appwiz.cpl with Administrator privileges.
  5. Respond to any UAC prompts as appropriate.

If the above does not work, there may be an issue with your system's Security Policy. Do the following to check:

  1. Log into the system under an account that has Administrator permissions.
  2. Press Win+R.
  3. Type secpol.msc and hit ENTER.
  4. Respond to any UAC prompts as appropriate.
  5. In the left pane, navigate the tree to the following location:

    Security Settings\Local Policies\Security Options

  6. Find the "User Account Control" options, near the bottom of the list.
  7. Check the setting User Account Control: Behavior of the elevation prompt for standard users
    • If it is set to Automatically deny elevation requests, you will not be able to use Administrator permissions while running under a standard user account.
    • If this is set to any of the Prompt for credentials... settings, and the above process for running appwiz.cpl elevated still does not work for you, then you may have a different problem.
3
  • very good answer, thanks well. do you coincidentally know if i can somehow get the path to the setup exes which are listed in the "Programs and Features" list?
    – philx_x
    Mar 3 '15 at 15:34
  • @philx_x That may be possible via WMI, PowerShell, or Registry queries. I'd suggest asking a separate question.
    – Iszi
    Mar 3 '15 at 15:58
  • This didn't work for me as apparently appwiz.cpl was loaded with regular user privileges even though I attempted to run it with elevated privileges through UAC prompt. My security policies are as you suggested they should be. The other answer here worked, though.
    – amn
    Apr 24 '17 at 14:44
5

For whatever reason, the control panel applets inherit the privileges of the running Desktop shell (which is the Windows equivalent of a window manager). To escalate permissions in the control panel, you have to escalate permissions in this shell, via these steps:

  1. Open a command prompt as an administrative user
  2. Kill the running explorer process
    1. Ctl+Shift+Esc Open task manager, and navigate to the processes tab
    2. Find the explorer.exe process(es), and kill all of them. (Right-click, choose End Process) Your taskbar, desktop, and explorer windows will all disappear, but your command prompt will remain
  3. From that admin command prompt, run explorer.exe
  4. Now, you should be able to open appwiz.cpl, or any other control panel applet with administrative privileges.
  5. When you're done, kill the running explorer process(es), and run explorer.exe as the logged-in user.

Caveat: This can lose certain settings, or break your normal desktop environment. For instance, any network paths which have been mounted to a drive will be lost.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.