Page 1 of 1 1
Topic Options
#170508 - 2006-11-20 11:03 PM shut it down SHUT IT ALL DOWN!!
Bryce Offline
KiX Supporter
*****

Registered: 2000-02-29
Posts: 3167
Loc: Houston TX
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)


Top
#170509 - 2006-11-20 11:36 PM Re: shut it down SHUT IT ALL DOWN!!
Allen Administrator Online   shocked
KiX Supporter
*****

Registered: 2003-04-19
Posts: 4572
Loc: USA
Dare I ask... why?
_________________________
(... better days ahead)

Top
#170510 - 2006-11-21 03:09 AM Re: shut it down SHUT IT ALL DOWN!!
Shawn Administrator Offline
Administrator
*****

Registered: 1999-08-13
Posts: 8611
hmmm yeah - I would like to know too. Happy BDay btw Allen.
Top
#170511 - 2006-11-21 04:26 AM Re: shut it down SHUT IT ALL DOWN!!
NTDOC Administrator Offline
Administrator
*****

Registered: 2000-07-28
Posts: 11634
Loc: Space
Well I suppose it's a LATE HAPPY BIRTHDAY - sorry guy. Missed that info.

Thanks Shawn for pointing it out.


Bryce said they're going to be having a power outage for the entire building so Mgmt wanted to shut down all the systems.
 


Edited by NTDOC (2006-11-21 04:27 AM)

Top
#170512 - 2006-11-21 05:33 AM Re: shut it down SHUT IT ALL DOWN!!
Bryce Offline
KiX Supporter
*****

Registered: 2000-02-29
Posts: 3167
Loc: Houston TX
something about a 12+hour power outage over the weekend...
Top
#170513 - 2006-11-21 05:38 AM Re: shut it down SHUT IT ALL DOWN!!
Allen Administrator Online   shocked
KiX Supporter
*****

Registered: 2003-04-19
Posts: 4572
Loc: USA
Thanks guys... its actually an early birthday wish... as my bday is not until 11/21... which is still another 20 mins or so away.

Bryce...glad to hear it wasn't something like the "I Love You" virus that hit the company I used to work for years ago... wow... thats been over 5 years ago... hard to imagine.
_________________________
(... better days ahead)

Top
#170514 - 2006-11-21 07:52 AM Re: shut it down SHUT IT ALL DOWN!!
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22346
Loc: OK
yeah, happy b-day

thinking about it, the servers should have power configuration set to shutdown when battery mode has been on for so long time.
I know, it never works perfectly, but you could try setting that on all ups aware servers.

Top
#170515 - 2006-11-21 08:59 AM Re: shut it down SHUT IT ALL DOWN!!
Arend_ Moderator Offline
MM club member
*****

Registered: 2005-01-17
Posts: 1896
Loc: Hilversum, The Netherlands
I wrote a similar thing about a year ago for elementary schools. To save power (but mainly for teachers and kids that leave the computers on) the loginscript wrote every workstation to an ini file containing the computername and the mac address.

Then a scheduled job would run a kix script that would read that ini to shut them all down at night. And wake them up in the morning. (Happy belated b-day Allen)

Top
#170516 - 2006-11-22 11:26 PM Re: shut it down SHUT IT ALL DOWN!!
masken Offline
MM club member
*****

Registered: 2000-11-27
Posts: 1222
Loc: Gothenburg, Sweden
the Power in pressing Enter hehe...
Top
#170517 - 2006-11-23 09:14 AM Re: shut it down SHUT IT ALL DOWN!!
Björn Offline
Korg Regular
*****

Registered: 2005-12-07
Posts: 953
Loc: Stockholm, Sweden.
Now, that's something that should be fun to have someone else test if it works
Top
#170654 - 2006-11-25 11:04 AM Re: shut it down SHUT IT ALL DOWN!! [Re: Arend_]
pvds Offline
Hey THIS is FUN
*****

Registered: 2001-04-14
Posts: 201
Originally Posted By: apronk
I wrote a similar thing about a year ago for elementary schools. To save power (but mainly for teachers and kids that leave the computers on) the loginscript wrote every workstation to an ini file containing the computername and the mac address.

Then a scheduled job would run a kix script that would read that ini to shut them all down at night. And wake them up in the morning. (Happy belated b-day Allen)


I write a script like that to but our students pulled the network off the system and there were no shutdowns.

This is what I am doing today I put a script in a AT job that looks if there is a user logged in if leave the machine on if there are no users working the script shuts down the machine I also use a logoff script in our screensaver to be sure users who stopped working are being logoff.

Code:
$a=GetObject('winmgmts:{impersonationLevel=impersonate, (Shutdown)}!\\.\root\cimv2').ExecQuery('Select * from Win32_ComputerSystem')
For Each $b In $a
If $b.UserName=""
  $c=Shutdown('','',0,0,2)
EndIf
Next
$a=0


Edited by pvds (2006-11-25 11:06 AM)

Top
#170661 - 2006-11-25 02:51 PM Re: shut it down SHUT IT ALL DOWN!! [Re: pvds]
Les Offline
KiX Master
*****

Registered: 2001-06-11
Posts: 12734
Loc: fortfrances.on.ca
In the AT script, check for network connectivity and shut down the PC if the user is not an administrator. That will stop the buggers from pulling the plug.
_________________________
Give a man a fish and he will be back for more. Slap him with a fish and he will go away forever.

Top
Page 1 of 1 1


Moderator:  Glenn Barnas, NTDOC, Arend_, Jochen, Radimus, Allen, ShaneEP, Ruud van Velsen, Mart 
Hop to:
Shout Box

Who's Online
0 registered and 1636 anonymous users online.
Newest Members
Viginette, ManuvdWielNL, Sir_Barrington, batdk82, StuTheCoder
17888 Registered Users

Generated in 0.15 seconds in which 0.114 seconds were spent on a total of 13 queries. Zlib compression enabled.

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