0

how can i shutdown a remote computer using C# ,i have tried to do it in command prompt it works fine but when i tried to integrate it to my c# code i get an error targetInvocationException was unhandled

program.cs

Application.SetCompatibleTextRenderingDefault(false);

Application.Run(new Form1());

-this is where error is located

form1.cs

System.Diagnostics.Process.Start("shutdown -s -f -t 60 -m\\192.168.23.18");

this the line of code i wanted to use

1 Answers1

0

Have you tried solutions from similar questions on StackOverflow?

  1. Using Process.Start
  2. Another using Process
  3. Using WMI
Community
  • 1
  • 1
Mikhail Tumashenko
  • 1,683
  • 2
  • 21
  • 28