Difference between revisions of "Shutdown Windows from Samba"

From Maze's wiki
Jump to: navigation, search
(Created page with '#!/bin/bash wks=(`nmap -sL --dns-servers 10.x.x.x,10.x.x.x 10.x.x.x/22, 10.x.x.x.x/23 grep FQDN|cut -d" " -f2 |grep -v -f serverlist`) for (( i=0; i < "${#wks[@]}"; i++)); do n…')
 
Line 1: Line 1:
 +
<pre>
 
#!/bin/bash
 
#!/bin/bash
  
Line 7: Line 8:
  
 
done
 
done
 +
</pre>

Revision as of 11:47, 17 June 2010

#!/bin/bash

wks=(`nmap -sL --dns-servers 10.x.x.x,10.x.x.x 10.x.x.x/22, 10.x.x.x.x/23 grep FQDN|cut -d" " -f2 |grep -v -f serverlist`)

for (( i=0; i < "${#wks[@]}"; i++)); do
net rpc SHUTDOWN -C "This system was left on after hours and is being shutdown" -f -I "${wks[$i]}" -U user_name%password

done