I have a specific PC in my local network which i want to shut it down by using C#. I have tried some commands and solution were presented here. But none of them worked. These are the commands i have tested:
Process.Start("shutdown", "-s -m \\192.26.85.188");
System.Diagnostics.Process.Start("shutdown", @"/s /m \\192.26.85.188 /t 5 /c 'Shutdown in 5 seconds'");
System.Diagnostics.Process proc = new System.Diagnostics.Process();
proc.EnableRaisingEvents = false;
proc.StartInfo.FileName = "shutdown.exe";
proc.StartInfo.Arguments = @"\\192.26.85.188 /t:10 'The computer is shutting down' /y /c";
proc.Start();
Process.Start("shutdown", string.Format(@"/s /t 0 /m \\{0}", "192.26.85.188"));
var shutdown = new ProcessStartInfo("shutdown", @"-m \\192.26.85.188 -s -f -t 0");
shutdown.CreateNoWindow = true;
shutdown.UseShellExecute = false;
Process.Start(shutdown);
That computer ip address is 192.26.85.188.
Is there any solution for doing this? Am i doing something wrong?
One note which could be important: That PC needs Username and Password to login. Should i provide any access by this US & pass in my code?