This forum uses cookies
This forum makes use of cookies to store your login information if you are registered, and your last visit if you are not. Cookies are small text documents stored on your computer; the cookies set by this forum can only be used on this website and pose no security risk. Cookies on this forum also track the specific topics you have read and when you last read them. Please confirm that you accept these cookies being set.

Remote shutdown a PC from visualization
#1
Hi,

Searching to find a way to remotely shut down some PCs from the Visualization, I cam across to this:

Shut Down From Linux
Once you’ve set up the computer, you can also shut it down from a Linux system. This requires the samba-common package installed – you can install it on Ubuntu with the following command:
Quote:
sudo apt-get install samba-common
Once you have, use the following command from a terminal:
Quote:
net rpc shutdown -I ip.address -U user%password


Is there an way to issue a net rpc shutdown command from an LM script?
Thanks in advance
Reply
#2
You can install Lua + Luasocket on Linux and create a simple script which receives UDP messages on a certain port. Then just do os.execute('poweroff') (or 'sudo poweroff' if not running a root) when a certain message is received.
Code:
sock = require('socket').udp()
sock:setsockname('*', 12345)
sock:settimeout(1)

while true do
  msg = sock:receive()
  if msg and msg == 'shutdown' then
    os.execute('poweroff')
  end
end

Then you can shutdown from LM like this:
Code:
sock = require('socket').udp()
sock:sendto('shutdown', '192.168.1.11', 12345)
Reply
#3
(04.07.2017, 06:05)admin Wrote: You can install Lua + Luasocket on Linux and create a simple script which receives UDP messages on a certain port. Then just do os.execute('poweroff') (or 'sudo poweroff' if not running a root) when a certain message is received.
Code:
sock = require('socket').udp()
sock:setsockname('*', 12345)
sock:settimeout(1)

while true do
 msg = sock:receive()
 if msg and msg == 'shutdown' then
   os.execute('poweroff')
 end
end

Then you can shutdown from LM like this:
Code:
sock = require('socket').udp()
sock:sendto('shutdown', '192.168.1.11', 12345)

Thank you for the reply but I was asking how to poweroff some windows machines from LM which is linux based...
Reply
#4
Hello, was this topic discussed beyond the last post? I'd also want to shut off Windows desktop PC though LM. Is there a way?
Reply
#5
Hi,

That would be a huge security gap (:

BR,

Erwin
Reply
#6
You can install a telnet server and then issue shutdown from LM via LuaSocket.
Reply


Forum Jump: