Page 1 of 1 1
Topic Options
#114191 - 2004-02-17 03:24 PM Enumerate entire network & shutdown
MichaelWassell Offline
Fresh Scripter

Registered: 2003-11-17
Posts: 32
Hello Everyone;

I'm sure that this would only take a few lines of code but I thought I would post it here for anyone with a better idea. I am in need of a script that will enumerate every netbios name on an internal network and execute the shutdown command for each pc enumerated.

I am going to be trying to put something together myself but it would be interesting to see what others have to say

Top
#114192 - 2004-02-17 03:49 PM Re: Enumerate entire network & shutdown
Howard Bullock Offline
KiX Supporter
*****

Registered: 2000-09-15
Posts: 5809
Loc: Harrisburg, PA USA
You could enumerate the names using NetView2() UDF. You then could use SHELL to execute shutdown.exe.
_________________________
Home page: http://www.kixhelp.com/hb/

Top
#114193 - 2004-02-17 04:04 PM Re: Enumerate entire network & shutdown
Sealeopard Offline
KiX Master
*****

Registered: 2001-04-25
Posts: 11161
Loc: Boston, MA, USA
Something like this?
Code:

dim $iRC

; set restrictive script settings
$iRC=SETOPTION('Explicit','on')
$iRC=SETOPTION('NoVarsInStrings','on')

dim $asCompList, $sComp

$asCompList=NetView2()

? 'Shutting down '+ubound($asCompList)+' computers'

for each $sComp in $asCompList
if $sComp<>@WKSTA
? 'Shutting down '+$sComp
$iRC=SHUTDOWN ($sComp, 'Scheduled network-wide computer shutdown', 10, 1, 0)
endif
next

$sComp=@WKSTA
? 'Shutting down '+$sComp
$iRC=SHUTDOWN ($sComp, 'Scheduled network-wide computer shutdown', 10, 1, 0)
exit 0

_________________________
There are two types of vessels, submarines and targets.

Top
Page 1 of 1 1


Moderator:  Jochen, Allen, Radimus, Chris S., Glenn Barnas, ShaneEP, Arend_, Mart 
Hop to:
Shout Box

Who's Online
4 registered (Jochen, AndreLuiz, Flavien, Arend_) and 206 anonymous users online.
Newest Members
Sjaak, Biybucket, Markus1961, Ian231, kixnewbie12
17480 Registered Users

Generated in 0.057 seconds in which 0.026 seconds were spent on a total of 12 queries. Zlib compression enabled.

Search the board with:
superb Board Search
or try with google:
Google
Web kixtart.org