Link to home
Start Free TrialLog in
Avatar of acameron
acameron

asked on

C# installer to install software as different user

Hello,

I would like to use C# or C/C++ to write a quick little installer to install a program I have (but did not write) as an administrator.  The program has to be installed as an administrator but I do not want to give out the admin password so I need an installer to install the program as admin even though the installer is getting called by say bob.
Avatar of Tonylmiller
Tonylmiller

Will Windows let you do that?  I wouldn't think so.  Users are not made administrators for a reason.  I'd be surprised if the software can override the user settings of the operating system.
ASKER CERTIFIED SOLUTION
Avatar of _ys_
_ys_

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of acameron

ASKER

I am getting a whole bunch of undeclared identifiers, what headers do I need to include to test this?
You should already have those functions protyped. A single #include "windows.h" is sufficient.
Nevermind, I found it.  Let me test this out and I will be back.
Oh yes, I thought you wanted the ability to do this on any machine where you would not know the admin password.
Ok, does not appear to be entering the if to assign user and then execute...
Found the problem I overlooked the Win2k issue.  I am running Win2k pro. any ideas?
As previously stated:

The user must have been granted the 'Act as part of the operating system' user right.

Sorry, but no other solution to it.
I've got it, I can make a system call to runas.  Any idea how I can make c++ wait for the password prompt, then enter the password?