Run my exe as a specific user?

FuturShoc

Active member
Joined
Jul 28, 2006
Messages
27
Location
Hot Springs, Arkansas
Programming Experience
3-5
My current project at work is to develop an application which will run on all client PCs in the field. This .exe application may run while an end user is currently logged in and using it, sometimes not and the cntl-alt-del screen is showing.

I can successfully run my exe at the cntl-alt-del screen, but it can't do some of the things it needs to without access to things like the network.

So, at this point, I'm fairly certain I need to be able to run my .exe application *as* a known user.

Currently the exe gets run by a service whose sole job it is to run it. I'm using system.diagnostics.process.start(exeFilePath) to run my exe from the service. Is there some way I can perform a "RUN AS"?
 
Like the impersonate function in C#?
There you can impersonate any user at a domain if you got the right username, password, and domainname.. as far as i can remember.. But I do not know of any function to do this i vb.net. Search google.com for impersonating user vb.net <-- or something :p
 
I'm using system.diagnostics.process.start(exeFilePath) to run my exe from the service. Is there some way I can perform a "RUN AS"?
Set the StartInfo for the Process, then just call its Start() method. The StartInfo is a ProcessStartInfo where you in addition to the process info can set UserName/Password account for which the process runs, there is also the LoadUserProfile that can be set if the process depends on user settings in the registry. Don't know how well it performs when called from a Windows Service, but you should try it.
 
Back
Top