Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Shut down computer on LAN?

Status
Not open for further replies.

Wings

Programmer
Feb 14, 2002
247
US
Hi,
Does anyone know of a way to remotely shut down a computer on a LAN? For that matter, how do I shut down the computer I am currently wouking on through C++ as well?

Thanks for the help.
 
Well, to my limited knowledge it's impossible to send a LAN command doing that. You could however have some program (client-server type) catching a command to a certain port and interpete it. One of the commands possible could be to make a shut-down.

This would in effect be a trojan-horse program and should be used with extreme caution but i can see a purpose in a LAN, it could even be a LAN-messaging program and such.

Totte
 
hi there,
there are many ways to manipulate other programs to shutdown the remote computer for u.for example,you can use an ftp server (you need to install it first of course...) to execute the shutdown.exe file on system32 directory.

how do u do it?
well,on the ftp server,you need to create a user called "shutdown" (the name is not important) and give him premission to write in a directory that you choose.put an empty txt file in that directory.

every ftp server software has "event configuration".
find it and look for your "favorite event"
(i chose "on renaming file" event).you will see that you can choose a file to execute when this event accures.
choose "shutdown.exe" on system32 directory.
whenever you log on to your ftp with user name "shutdown"
and rename a file that's in there, your ftp server will execute "shutdown.exe" and the remote computer will be shut.

this works great.the only problem is that you need a dns name for your ftp server in order to bypass the need for ip address of the remote computer.
try
 
Hello,
to shutdown/restart/logoff windows use WinAPI function ExitWindowsEx(...)
But, on WinNT derivatives you must have privileges to execute this, so use AdjustTokenPrivilege(...) function to obtain privileges. You don't need it on Win 95/98/Me.
However, these functions and things surrounding them are too big to describe in one post, so start digging your MSDN/WINSDK :)
Post again if you have problems with these. I've used this method few times (e.g. to shutdown all machines in network from one place, but you would need your LAN protocol/apps) and it's the only clean/documented way to shut-down a machine.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top