Solved

how to run a program as adminitrator via the command line?

Posted on 2016-09-27
8
82 Views
Last Modified: 2016-09-28
My account name is ''user1'' and i don't have administartors rights
The 2'nd acc. called: ''admin1'' is the administrator
My question is:How can i run a Program.exe from my acc. using cmd.exe as administrator(using admin1 rights)

i tried this,i sucessfully connect as admin1, but when i try to run the tool.exe says:Acces Denied
runas /user:admin1 cmd.exe 

Open in new window

0
Comment
Question by:john lambert
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 4
  • 3
8 Comments
 
LVL 7

Accepted Solution

by:
D Patel earned 500 total points
ID: 41817573
Create a new txtfile, pase this content:

@echo Set objShell = CreateObject("Shell.Application") > %temp%\sudo.tmp.vbs
@echo args = Right("%*", (Len("%*") - Len("%1"))) >> %temp%\sudo.tmp.vbs
@echo objShell.ShellExecute "%1", args, "", "runas" >> %temp%\sudo.tmp.vbs
@cscript %temp%\sudo.tmp.vbs
and save it as SUDO.cmd.
Now copy the cmd to your system32 folder.

When you now want to run a programm with admin rights type this:

sudo cmd /k javaw.exe JAVA file
Now accept the UAC prompt.

Hope this helps.
1
 
LVL 7

Expert Comment

by:D Patel
ID: 41817577
runas /profile /user:administrator “Driver:\folder\program”

For example, the administrator account is “AAA” and you want to run BBB.exe of C:\programs, you should do these following steps:

1 Press Win key & R

2 Input “CMD” in open box and click “OK”

3 Input: runas /profile /user:AAA “C:\programs\BBB.exe”  and press “Enter”

4 Input the password of administrator AAA

5 Press “Enter”

Hope it works.
0
 
LVL 10

Expert Comment

by:Muhammad Mulla
ID: 41817588
Which OS are you using?
0
Get Actionable Data from Your Monitoring Solution

Your communication platform is only as good as the relevance of the information you send. Ensure your alerts get to the right people every time with actionable responses. Create escalation rules that ensure everyone follows the process and nothing is left to chance.

 

Author Comment

by:john lambert
ID: 41817603
i'm using 2 rdp's one of them server2008 rc2 and a windows7 so first i tried ''D Patel'' method:
I receive this message: this operation needs administartor rights

This not working
runas /profile /user:admin1 ”C:\folder\optimizer.exe”

This open my tools but when i run it,still asking for admins rights
runas /profile /user:admin1 C:\folder\optimizer.exe
0
 

Author Comment

by:john lambert
ID: 41817612
this method seems to work but if UAC is disabled?is possible that ?

works fine:

@echo Set objShell = CreateObject("Shell.Application") > %temp%\sudo.tmp.vbs
@echo args = Right("%*", (Len("%*") - Len("%1"))) >> %temp%\sudo.tmp.vbs
@echo objShell.ShellExecute "%1", args, "", "runas" >> %temp%\sudo.tmp.vbs
@cscript %temp%\sudo.tmp.vbs
and save it as SUDO.cmd.
Now copy the cmd to your system32 folder.

Open in new window

0
 
LVL 7

Expert Comment

by:D Patel
ID: 41817663
Does UAC is already disabled or you did it?

If you did it then you will have to restart your PC first and then check the result.
1
 

Author Comment

by:john lambert
ID: 41817908
UAC worked well...but in case UAC is disabled,uhh will be more dificult
0
 

Author Closing Comment

by:john lambert
ID: 41819340
thank you...problem solved!!!!
0

Featured Post

Enroll in June's Course of the Month

June’s Course of the Month is now available! Experts Exchange’s Premium Members, Team Accounts, and Qualified Experts have access to a complimentary course each month as part of their membership—an extra way to sharpen your skills and increase training.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

The following is a collection of cases for strange behaviour when using advanced techniques in DOS batch files. You should have some basic experience in batch "programming", as I'm assuming some knowledge and not further explain the basics. For some…
How to remove superseded packages in windows w60 or w61 installation media (.wim) or online system to prevent unnecessary space. w60 means Windows Vista or Windows Server 2008. w61 means Windows 7 or Windows Server 2008 R2. There are various …
In this video, viewers are given an introduction to using the Windows 10 Snipping Tool, how to quickly locate it when it's needed and also how make it always available with a single click of a mouse button, by pinning it to the Desktop Task Bar. Int…
Monitoring a network: why having a policy is the best policy? Michael Kulchisky, MCSE, MCSA, MCP, VTSP, VSP, CCSP outlines the enormous benefits of having a policy-based approach when monitoring medium and large networks. Software utilized in this v…

687 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question