Maybe Impersonization is the wrong word, I need to run a process on the local PC that the program runs on as a different user than the user that is logged on. From what I understand, when using ProcessStartInfo, setting the UserName, Password and Domain will accomplish this task.
I simplified my code to simply run notepad.exe. I copied notepad.exe into "MyFiles" directory.
Remember, I'm setting the UserName, Password and Domain to my own credentials. I still get the same results:
Dim p As New ProcessStartInfo()
With p
Dim exec As String = "C:\Program Files\MyFiles\notepad.exe"
If File.Exists(exec) Then
p.FileName = exec
p.WindowStyle = ProcessWindowStyle.Hidden
p.UseShellExecute = False
p.RedirectStandardOutput = True
p.RedirectStandardError = True
Dim x As Process = Process.Start(p)
Dim output As String = x.StandardOutput.ReadToEnd()
Dim err As String = x.StandardError.ReadToEnd()
WriteLog("output: " & output)
WriteLog("err: " & err)
x.WaitForExit()
End If
End With
In my opinion, this has nothing to do with what process I am trying to run.
Thank you,
tshaffer