Tuesday, August 18, 2009

Remote shutdown Windows from Linux

SkyHi @ Tuesday, August 18, 2009
Just run the following command:

net rpc SHUTDOWN -C “enter a comment to display at shutdown” -f -I x.x.x.x -U username%password


where x.x.x.x is the ip address.

To know what machines are on in a particular subnet just nmap it, like this:

nmap -sP 192.168.5.0/24 | cut -d ” ” -f2 > lixo.txt


And with the lixo.txt you can cicle the computers and shut them down, just run this:

for i in $(cat lixo.txt);do net rpc SHUTDOWN -f -I $i -U user%password; done


Reference: http://manueljoaosilva.com/2009/06/remote-shutdown-windows-from-linux/