Run my program under other user

  • Thread starter Thread starter Philip Wagenaar
  • Start date Start date
P

Philip Wagenaar

I have a program that has to run under the administrator
account. But the use that will start the program has it's
own (limited) account.

How can I run a program under administrator?

I'd like solution that is a secure as possible. So not
using run as or something on command prompt.
 
Look into impersonation. It's a little confusing, but sounds like what you
may be looking for. Most examples are in ASP.NET (I think all of them are,
but don't see why you couldn't still use it).

-CJ
 
Philip I'm not sure if this is what your looking for but
if you add a setup and deployment project to your
solution after compilation when you initially install
your application the setup wizard will give you the
standard option of enabling the application for 'me only'
or 'anyone who uses this computer' if your looking for
something more sophisticated than this you will have to
wait for an experts response

Regards Steve
 
You have two options here:-
1) If your program has to have administrative privileges to run because of
specific registry access or file access - login as an administrator and set
permissions against the registry entries or files for your program.

2) There are examples around on the net in VB that allow you to run your
program as another user - its the same as Run As but coded into your
program - only trouble here is that you need to store the user and password
within the program which could be viewed through a hex editor or decompiled.
Possible ways around this though is to store the user name and password
within the program encrypted, and within your program have a decryption
routine - although this doesn't necessarily get around decompilation of your
program.

Merlin
 
* "Philip Wagenaar said:
I have a program that has to run under the administrator
account. But the use that will start the program has it's
own (limited) account.

How can I run a program under administrator?

I'd like solution that is a secure as possible. So not
using run as or something on command prompt.

VB6 sample for "impersonation":

<http://www.gssg.de/impers.zip>
 
Back
Top