0

Possible Duplicate:
System.Diagnostics.Process.Start a process against a different domain

For background on what I am trying to do you might want to look at: System.Diagnostics.Process.Start a process against a different domain

Basically even though it 'looks' like ProcessStartInfo lets you run against another domain account, it doesn't, at least not in my scenario. So my next attempt was to programmatically mimic the following batch command and then simply read/write to the console to supply the password (if you run the following from cmd line it will prompt "Enter the password for SOMEDOMAIN\SomeUserName" and it waits for your input, when you key in the password it launches SSMS as the correct domain account and everything works fine

RUNAS /user:SOMEDOMAIN\SomeUserName /netonly "C:\Program Files (x86)\Microsoft SQL Server\100\Tools\Binn\VSShell\Common7\IDE\Ssms.exe"

But for some reason I cant fathom, when I run the exact same command from C# it never waits for the Password input, as soon as you submit the above command it launches SSMS and since the password was never captured it fails trying to connect to a db. I tried running the command above as well as first running cmd.exe and then writing the command to the process input stream but to no avail. How do I get it to accept my input then wait while I read the output and respond with the password? I find this baffling

Community
  • 1
  • 1
snappymcsnap
  • 2,050
  • 2
  • 29
  • 53
  • @HansPassant- possible duplicate? I referenced that post intentionally because it was a)made by me and b)related to this one – snappymcsnap Oct 25 '12 at 17:57
  • the problem lies in redirecting the input/output, as soon as you do that it doesn't 'wait' which is what I want. If I don't redirect the input/output it will launch in a cmd window with the prompt and wait as expected – snappymcsnap Oct 26 '12 at 14:15

0 Answers0