You are here

How to run an app as another user?

7 posts / 0 new
Last post
rpr
Offline
Last seen: 8 years 1 month ago
Joined: 2013-02-19 08:44
How to run an app as another user?

Hi!

On Windows 7 Pro. SP1 I log in as a user who is not an administrator in Windows but only a "restricted" user (more precisely, the user is not a member of the local Administrators group but is only a member of the local Users group). Sometimes I need to run an app as another user in Windows, namely as a user who is an administrator on the local machine or an administrator in a Windows domain (in corporate environment). I can't find a way to do it in PortableApps 11.2.

On https://portableapps.com/support/portable_apps_suite#runasadmin I read: "You can run a portable app as another user by right-clicking and selecting Run As Admin."

If I do it in Windows 7 the app starts as the current user and probably tries to get elevated privileges (which it cannot get as the user is a "restricted" user). I've checked this with Task Manager and Process Explorer.

When you start apps from Windows 7 Start Menu you can right-click with the Shift key pressed and you have two options:
- Run as administrator
- Run as different user
When you choose the second option you are prompted for username and password of the account under which you want to run the app. The username can also be specified as DOMAIN\username to change the default domain.

I'd like to have the second option in PortableApps. Is it possible?

ottosykora
Offline
Last seen: 2 hours 8 min ago
Joined: 2007-10-11 17:48
works here

>On https://portableapps.com/support/portable_apps_suite#runasadmin I read: "You can run a portable app as another user by right-clicking and selecting Run As Admin."

If I do it in Windows 7 the app starts as the current user and probably tries to get elevated privileges (which it cannot get as the user is a "restricted" user). I've checked this with Task Manager and Process Explorer.

Otto Sykora
Basel, Switzerland

rpr
Offline
Last seen: 8 years 1 month ago
Joined: 2013-02-19 08:44
> Right click on the app in

> Right click on the app in the platform menu, select run as administrator, then a prompt will pop up asking you for a password of one of the administrators and then the program will run under admin privileges and the administrator account selected.

In PortableApps 11.2 I get no prompt after I select "Run as administrator".
The Windows 7 Pro. machine is joined to a Windows domain.

-- rpr.

ottosykora
Offline
Last seen: 2 hours 8 min ago
Joined: 2007-10-11 17:48
other installs

do you get the normal response on other installations or tasks requiring admin rights?

When I attempt to run anything as admin from the portable menu, I am getting the same response as when I do it otherwise from windows and try to install something etc. Also on w7 pro. Only my are not connected to a domain, but this should not make any difference.

Otto Sykora
Basel, Switzerland

rpr
Offline
Last seen: 8 years 1 month ago
Joined: 2013-02-19 08:44
the issue is caused by UAC disabled

I've found out that I have this issue because I have the User Account Control disabled in Windows 7.

The UAC is disabled by a domain group policy which disables the following option in the Local Computer Policy (which can be managed with secpol.msc):

Computer Configuration > Windows Settings > Security Settings > Local Policies > Security Options
User Account Control: Run all administrators in Admin Approval Mode

When the domain group policy is removed and the option in Local Computer Policy enabled, "Run as administrator" works as expected in PortableApps.

So, I'd like this somehow fixed in PortableApps. For example it could also offer the "Run as different user" option for starting an app (which is present in Windows 7 Start Menu when you right-click an app with the Shift key pressed).

-- rpr.

John T. Haller
John T. Haller's picture
Online
Last seen: 27 min 14 sec ago
AdminDeveloperModeratorTranslator
Joined: 2005-11-28 22:21
RunAs

The platform isn't doing anything special to elevate permissions. We're simply calling ShellExecute with the runas option passed at which point the entire thing is in the hands of Windows. There is no additional 'run as a different user' option for starting an app, so this is working as designed on your copy of Windows. If you disable UAC and have Run all administrators in Admin Approval Mode on, you'll get the behavior you described earlier.

In order to be able to run as a different user, we'd need to create the GUI and the call ourselves, possibly parsing the available users, getting tokens, and calling CreateProcessAsUser. There doesn't seem to be a direct API to handle this ala runas and Run As a Different User is present in Windows XP, was removed in Vista, and then is back in 7 and 8 when you hold SHIFT, so there is likely no standard API for it either. We could, in theory, do it via RunAs on the command line, but we'd need to ask the user for their Windows password via our own GUI, which is a bit off-putting to say the least.

Sometimes, the impossible can become possible, if you're awesome!

rpr
Offline
Last seen: 8 years 1 month ago
Joined: 2013-02-19 08:44
a workaround

If the "Run as different user" option in PortableApps would require to much work, then a workaround which I can do is to run PortableApps as another user (because Windows 7 Start Menu offers "Run as different user" option). After that every app I start within PortableApps menu runs as that user. I'd say I can live with that Smile

-- rpr.

Log in or register to post comments