Solved

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

Posted on 2016-09-27
8
76 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
DevOps Toolchain Recommendations

Read this Gartner Research Note and discover how your IT organization can automate and optimize DevOps processes using a toolchain architecture.

 

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

On Demand Webinar - Networking for the Cloud Era

This webinar discusses:
-Common barriers companies experience when moving to the cloud
-How SD-WAN changes the way we look at networks
-Best practices customers should employ moving forward with cloud migration
-What happens behind the scenes of SteelConnect’s one-click button

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…
AutoHotkey is an excellent, free, open source programming/scripting language for Windows. It started out as a keyboard/mouse macros product, but has expanded into a robust language. This article provides an introduction to it, with links to addition…
Email security requires an ever evolving service that stays up to date with counter-evolving threats. The Email Laundry perform Research and Development to ensure their email security service evolves faster than cyber criminals. We apply our Threat…
The Email Laundry PDF encryption service allows companies to send confidential encrypted  emails to anybody. The PDF document can also contain attachments that are embedded in the encrypted PDF. The password is randomly generated by The Email Laundr…

733 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