3

I have a windows 7 user who belongs to admin group. I want to execute sc command that requires admin privileges. I DON'T want to open an elevated cmd, want to be able to simply Win+R->Enter command, enter password and that's all. I tried the runas command, but it doesn't seem to work:

>runas /user:me "cmd"

and it asks for a password, and then the command is executed with normal privileges. I know I could use /user:administrator but I don't know the admin pass and I think the admin user (me) should work.

vangop
  • 169
  • 1
  • 5

3 Answers3

7

Runas does not elevate commands due to UAC.

You can't run elevated commands in the run dialog either. You can download the "Elevation Powertoys" which allow you to elevate commands as elevate <i>command</i>

Or just use the start menu and press Ctrl + Shift + Enter.

surfasb
  • 22,896
0

You can use Administrator account for running a command on admin mode without UAC notification

runas /user:Administrator "cmd"

to save credential and run the command without retyping password again:

runas /user:Administrator /savecred "cmd"

NOTE:

Please make sure that you have activated Administrator user from Computer Management-> Local Users and Group and have set a safe password for Administrator user

Ali
  • 294
-1

I had the same problem like you, arguing windows does not provide such a simple thing built in. There exists a 3rd party tool for it I use for a few years now: Elevate.exe

This program does not depend on saved credentials and can be controlled whether waiting until target program exists or not. Elevate64.exe is for 64 bit architecture only, Elevate.exe works for both 32 bit and 64 bit. You can inspect the command-line options and download it here: https://www.winability.com/elevate/

Syntax: elevate [-opt1] [-opt2...] [path]file[.exe] [param1 [param2...]]

Recommended options to use: -wait4exit -noui

Example: Elevate.exe -wait4exit -noui "calc.exe"

Hope it will help you.