I need to start a process using a different windows user account. I usually do web development and would just use impersonation with that, but I have been working on a Win Forms app and am unsure of the best way.
newproc.StartInfo.FileName = "C:\Program Files\Internet Explorer\iexplore.exe"
newproc.StartInfo.Domain = "Domain"
newproc.StartInfo.UserName = "username"
newproc.StartInfo.Password = "password"
newproc.Start()
Is there something wrong with the above code? I get a system.invalidOperation exception when running the code.
Thanks in advance for any ideas.
JTG
I have been playing with this today and taken another approach based on some google results.
'check for impersonation
If globalVars.ImpersonationUsername IsNot Nothing Then
'Secure Password
globalVars.secureString(globalVars.ImpersonationPassword)
'set process params
Process.Start(temp(1), globalVars.ImpersonationUsername, globalVars.ImpersonationSecurePassword, "bds")
Exit While
Else
Process.Start(temp(1))
End If
I get a win32 exception when using a different username and password... should this code work?
Got it working. This code works fine 
Process.Start(temp(1), globalVars.ImpersonationUsername, globalVars.ImpersonationSecurePassword, "bds")
Sorry, you must be a member to post to a conversation. Either
log in or
sign up
to get involved.