Shutdown Windows from Samba

From Maze's wiki
Revision as of 11:47, 17 June 2010 by Admin (talk | contribs)

Jump to: navigation, search
#!/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