0

Possible Duplicate:
Start non-elevated process from elevated process

Story:
Standard-User launches a MSI As Administrator and Msi launch a Process(Lets say Sample.exe) on setup finish.
Problem:
Sample.exe starts with Administrator rights instead of current desktop (statndard) user. This is causing some problem.
So i want that sample.exe should start with current window logged in user(standard user).

I did some googling and found this Article . But this article is in C++ and I am using C# and WIX . So if there is any other simple way to do this in c# and if Not then how can i use this article's code in my project.

NOTE: This question has been asked multiple time on stackoverflow but i didnt find the answer for c#

Community
  • 1
  • 1
USER_NAME
  • 1,029
  • 1
  • 14
  • 33

1 Answers1

2

Per best practices, an installer should...

  • Launch non-elevated as standard user
  • UI Installation sequence is not elevated
  • Transition to execute sequence will prompt for confirmation. If user is Admin they get UAC prompt. If user is not Admin they get prompted for "over the shoulder" credentials of an admin
  • Custom actions scheduled as Immeadiate of Deferred with Impersonation runs with user context (non-elevated)
  • Custom actions scheduled as Deferred with No Impersonation runs elevated as SYSTEM

If the MSI is launched from an elevated process ( such as CMD run as admin ) then the UI and Execute will all be elevated. This is by design and there is no way to de-elevate this to my knowledge nor can I think of any reason why you would want to.

Alexey Ivanov
  • 11,541
  • 4
  • 39
  • 68
Christopher Painter
  • 54,556
  • 6
  • 63
  • 100
  • Reason: My application downloads the updated version from internet If logged in user is standard then Msi is launched by the credential of admin(this username and password we ask from user at the time of fresh installation).After update when click on finish on MSI wizard with "start application" option checked then application launches properly but at the time of login into application with live id microsoft's idcrl library is reporting "debug assertion error" And if user uncheck the "start application" option and start the application from double click on exe then everything works fine. – USER_NAME Sep 20 '12 at 15:26
  • So it's an autoupdating pattern. Do you have the ability to run a command as Admin and then run a command as User? If so, the Admin process could "advertise" (bless) the MSI using the msiexec /jm command and thne the User process could install the blessed package using msiexec /i. All MSI best practices must be followed though for this to work. – Christopher Painter Sep 20 '12 at 17:14
  • is /jm switch works on domain accounts? – USER_NAME Sep 21 '12 at 05:28