Rookie: How to run application with specific user account?

  • Thread starter Thread starter Dave Guenthner
  • Start date Start date
D

Dave Guenthner

Hi. I have a c# console application that works fine when
it is executed under the context of a user account who is
Administrator of the local machine. However, my
production environment, no end user is a full
Administrator of their machine. Is there a best practice
or way out there to simply specify the credentials of a
user account which has the Admin rights for this app to
run under while being logged into machine with say a
simply domain user account?

Thanks in adavance.

Dave
 
One way to run apps as another user is to run it from scheduler, that way
you can add credentials right into the scheduler settings. Its only really
appropriate if your app requires no interaction however as it runs in the
background.

Another approach is to use impersonation
http://www.codeproject.com/csharp/cpimpersonation1.asp

--
Regards

John Timney (Microsoft ASP.NET MVP)
----------------------------------------------
<shameless_author_plug>
Professional .NET for Java Developers with C#
ISBN:1-861007-91-4
Professional Windows Forms
ISBN: 1861005547
Professional JSP 2nd Edition
ISBN: 1861004958
Professional JSP
ISBN: 1861003625
Beginning JSP Web Development
ISBN: 1861002092
</shameless_author_plug>
 
Back
Top