Reputation: 3236
I am not asking how to code it
Process.Start("shutdown","/s /t 0");
I am asking if I made a user interface to detect the computers in the network. Knowing their ip and having domain admin priveledges. How do I send a signal to execute my c# .exe ?
Upvotes: 0
Views: 4592
Reputation: 5813
That would be so wrong to be able to execute applications remotely, right? :) I think best method is to write your C# executable as a background service. To send remote messages, WCF is very useful. Here are the links you need:
How to write a background service in c#: (you may already know it, i send the link just in case)
http://www.codeproject.com/KB/install/csharpsvclesson1.aspx
About WCF: (which you will need to call functions from a remote computer)
http://msdn.microsoft.com/en-us/library/ms731082.aspx
edit: i didn't know about shutdown command's extra parameters. if that method works, it's much easier of course.
Upvotes: 2
Reputation: 1235
The command line is
shutdown /m \\<MACHINE NAME OR IP>
so you can use:
Process.Start("shutdown",string.Format(@"/s /t 0 /m \\{0}",machineIp));
Upvotes: 4