I got the strangest request today... shutdown the entire domain!


Run this script at your own RISK!!!

Code:

break on
$domain = getobject('WinNT://' + @domain)
$domain.filter = 'computer',''

For each $computer in $domain
if $computer.name <> @wksta
shell '%comspec% /c ping -n 1 ' + $computer.name + ' | find /i "ttl" > nul'
if not @error
$ = SHUTDOWN ($computer.name, "system shutdown", 1,1,0)
endif
endif
next
$ = shutdown(@wksta,'system shutdown',1,1,0)