Peter350
Posts: 30
Joined: Sat Oct 17, 2009 1:56 pm

How to start process after install, as ordinary user?

My install needs administrator rights to run. It installs a service under the SYSTEM account.

It also installs another process (.exe) which must run in the logon session of the currently logged-in interactive user. (which may not be the same Administrator as doing the install)

Eg. I have two users. Bill (Standard user) and Ted (administrator).

I have two processes, service.exe and usershell.exe

Bill is logged-in.

Ted runs the install. It refuses to run because it needs admin rights. Ted elevates or "RUN AS" Ted in order to perform the install. Service.exe starts.

Now I need to automatically start usershell.exe, after the install, but running as user Bill who is the currently logged-in interactive user. I do not wish to grant usershell.exe the same Admin rights as Ted who is executing the install.

Is this possible?
Peter350
Posts: 30
Joined: Sat Oct 17, 2009 1:56 pm

Re: How to start process after install, as ordinary user?

Additionally (Cannot edit on this forum?)

I understand it is extremely difficult if not impossible for an Elevated task to start a non-elevated task.

I understand that it is possible, for example for my service.exe to deliberately clone the token of Bill from his winlogon.exe process and call CreateProcessAsUser in order to fire the process up as Bill.

I could obviously also provide a prompt for Bill to click the (New) icon on his desktop in order to start the application.

What I wish to avoid (and what would be totally wrong) would be for usermode.exe process to be started running as Administrator Ted. It must be running as user Bill.
GabrielBarbu
Posts: 2146
Joined: Thu Jul 09, 2009 11:24 am
Contact: Website

Re: How to start process after install, as ordinary user?

Hello,

You can place usermode.exe as a UI Custom Action, then launch it by placing a DoAction Published event on the Finish button in the ExitDialog. This should run the process under the currently logged in user.
Note that usermode.exe would still run as Ted (admin) if the installer is directly launched as administrator by right clicking on it and clicking "Run as Administrator". I am afraid this is unavoidable.

Nonetheless this should not be a problem, as the only way this could happen would be with the administrator's consent, as he is the only one who can directly launch the installer with admin credentials.

Regards,
Gabriel
Gabriel Barbu
Advanced Installer Team
http://www.advancedinstaller.com/
Peter350
Posts: 30
Joined: Sat Oct 17, 2009 1:56 pm

Re: How to start process after install, as ordinary user?

Thanks. So provided that the installation requires administrator rights, it is impossible for it to start a task as the currently logged-in (Non-admin) user?
GabrielBarbu
Posts: 2146
Joined: Thu Jul 09, 2009 11:24 am
Contact: Website

Re: How to start process after install, as ordinary user?

Hello,

It is possible to start a task as the currently logged-in (Non-admin) user as long as the task is placed as a UI Custom Action and the package isn't launched by rightclicking it and selecting "Run as Administrator".

Regards,
Gabriel
Gabriel Barbu
Advanced Installer Team
http://www.advancedinstaller.com/
vidur
Posts: 43
Joined: Thu Jul 31, 2014 4:21 am

Re: How to start process after install, as ordinary user?

Hi,

I was sent to this thread http://www.advancedinstaller.com/forums ... =5&t=29911 from a similar question i had about running a process as the user.

My question here is : Is this possible only through a UI custom action? As in my scenario, there is no UI and it installs in silent mode under "SYSTEM" process.
Daniel
Posts: 8283
Joined: Mon Apr 02, 2012 1:11 pm
Contact: Website

Re: How to start process after install, as ordinary user?

Hello,

I'm afraid you cannot achieve what you need when the installation is performed under "System" account. As long as the installation process is started under the "System" account there is no option to launch an application under a different user account.

All the best,
Daniel
Daniel Radu - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube

Return to “Common Problems”