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)