How do you run another .exe from VB.NET but as another User?
I expect to launch a .exe like "Left Click -> Run As -> Enter User/Pass -> Click OK" If I do that, my application runs as expected (I need to run it as another user to get access to some folders in the network)
But if I use this in VB.NET
System.Diagnostics.Process.Start(System.Windows.Forms.Application.ExecutablePath, PARAMETER, USER, PASSWORD, DOMAIN)
The application runs with the other user.. but Excel (inside my App with Interop) fails to open the file in the restricted folder.
(I run again the same app but with a different user, just to avoid creating more .exe files... but I already tried with vbScript)
Again, Process.Start FAILS to open excel using the other User... but Left Click -> Run as succedes at that... why?? another way??
this is what the app does:
- Open the app
- check if there's a parameter
- if no parameter, then relaunch the application with the other user and send some parameter
- if there is a parameter open excel
- open a xlsx file
but if I double click... Excel opens... uses 50% CPU, and gives me the error that it can't open the file...
if I run it directly with the desired user and pass... everything executes fine Any suggestions as how to solve this? (impersonate works fine.. but it opens Excel with the actual user.. not the one with rights)
Thanks!