0

I'm trying to figure out how does

scmd shutdown /m \192.168.1.X

works so I can us it in c# program

LarsTech
  • 80,625
  • 14
  • 153
  • 225
Filip
  • 397
  • 1
  • 5
  • 14
  • You want to run that program in C# ? – Micah Armantrout Mar 16 '12 at 14:17
  • http://stackoverflow.com/questions/102567/how-to-shutdown-the-computer-from-c-sharp – Micah Armantrout Mar 16 '12 at 14:18
  • Well i know the command but my employee dont like that solution because it wont throw errors if they happen but also wont allow me to install client program on the other side so i guess i have use some code to log on the other network machine and make shutdown remotely but i dont see a way how – Filip Mar 16 '12 at 14:51

2 Answers2

0
Process.Start( "scmd shutdown /m \192.168.1.X" );

See http://msdn.microsoft.com/en-us/library/53ezey2s.aspx

Nick
  • 25,026
  • 7
  • 51
  • 83
  • Well i know the command but my employee dont like that solution because it wont throw errors if they happen but also wont allow me to install client program on the other side – Filip Mar 16 '12 at 14:25
0

Instead of writing your own code to shutdown remote computers maybe you can capture the output of the command and parse it to see if it was successful or get the error message.

see: How to spawn a process and capture its STDOUT in .NET?

Community
  • 1
  • 1
Marius
  • 833
  • 5
  • 11