2

I have an application FOO that does not usually need admin permissions. And also I have a link within website that allows me to start this FOO application.

By default that FOO is started with permissions of a user. The only way to start FOO is by clicking a website link (parameters, that are passed to a client application are crucial).

In some cases, user needs to start that application from webbrowser with admin permissions. I want to have two links on a website, one of them - to allow users to start with usual permissions, another one- with elevated permissions.

Is there any parameter or modifier within custom protocol link that would allow me to tell OS on a target machine that I need to start my application as administrator?

EXAMPLE

<a href="Mycustomprotocol:baseurl=paramurl&username=paramname"> Click me for launch</a> 
DreamTeK
  • 32,537
  • 27
  • 112
  • 171
Sasha Reminnyi
  • 3,442
  • 2
  • 23
  • 27
  • 1
    if FOO.exe is located on a network share, you can `right click it`, `properties`, `compatibility` > check `run this program as an administrator`. you can also invoke the 'runas' command in a 3rd party exe\script. google "windows runas command" – Stavm Apr 25 '17 at 13:18
  • @Stavm That's decided by a person who clicks the link in Webbrowser. The idea is good, but the end user is not supposed to operate with his Foo.exe locally. I would rather have two links on a website, one of them starting app in user mode, another, as administrator. But I'm not aware if that's possible to specify this second link. – Sasha Reminnyi Apr 25 '17 at 13:25
  • can you please post some code that shows how you invoke foo.exe – Stavm Apr 25 '17 at 14:21
  • Click me for launch – Sasha Reminnyi Apr 25 '17 at 14:42
  • 1
    this means your users invoke the exe locally. you can use the `runas` command. point your users to a batch file instead of an exe, and have that batch file invoke `runas` foo.exe with the parameters passed to it. http://stackoverflow.com/questions/13364781/runas-does-not-allow-complex-arguments – Stavm Apr 25 '17 at 14:50
  • @Stavm perfect. I thought of this mechanism, but was not sure how to implement it. Can you answer my question so that I could mark it as resolved? – Sasha Reminnyi Apr 25 '17 at 17:02
  • @Stavm, the `runas` command-line tool is for running processes as a different user, not for running processes with elevated privilege. (If you specify the local administrator account it will run the process elevated, but that account is disabled by default.) – Harry Johnston Apr 26 '17 at 04:36
  • 1
    Sasha, presumably your custom protocol is passing the parameters to the locally installed executable. Couldn't you add an extra parameter asking the executable to self-elevate? – Harry Johnston Apr 26 '17 at 04:37
  • @HarryJohnston Great catch! I didn't think about it at all! – Sasha Reminnyi Apr 26 '17 at 11:13
  • Possible duplicate: http://stackoverflow.com/q/2081945/886887 – Harry Johnston Apr 26 '17 at 11:49

1 Answers1

0

you can use the runas command.

point your users to a batch file instead of an exe, and have that batch file invoke runas foo.exe with the parameters passed to it.

Example: runas does not allow complex arguments?

Community
  • 1
  • 1
Stavm
  • 7,833
  • 5
  • 44
  • 68