Shutdown a remote computer connected in LAN in any preferable language

10,580

Solution 1

Assuming a windows box.

In VB.NET or c#

Process.Start("shutdown","-s -m \\Machine");

Should do the trick.

See
http://msdn.microsoft.com/en-us/library/system.diagnostics.process.start.aspx
http://www.ss64.com/nt/shutdown.html

EDIT: Note - shutdown.exe was only available in Resource Kits prior to Windows 2003

Solution 2

You can connect to any computer on the domain and shut it down using the Win32Shutdown method of the WMI class Win32_OperatingSystem. In .NET you access WMI through the System.Management namespace.

Solution 3

Invoke shutdown -s -m \\computername command through a primitive used to start processes (like Process.Start() or CreateProcess()).

Solution 4

If the remote computer is a Windows box you can use WMI (Windows Management Instrumentation).

http://msdn.microsoft.com/en-us/library/aa394582.aspx

Use the Reboot() method of the Win32_OperatingSystem class. You could do this for example using Windows Script, C#, VB .net

Solution 5

  1. Connect to the host through SSH
  2. user@domain:~$ sudo shutdown -h now
Share:
10,580
sivakumar
Author by

sivakumar

Updated on June 05, 2022

Comments

  • sivakumar
    sivakumar almost 2 years

    I want to shut down a remote Windows computer (ex. a Windows computer connected in LAN.) I have tried a lot but I could not find the solution. Does anyone have an idea on how to shut down the remote computer? Any language would work.