Monday, March 29 2010 @ 05:00 PM EDT
Contributed by: Seker
Here are a couple VBScripts that you can use to shut down computers if no one is logged on at the time the script is run. This is useful if you want to make sure computers are shut down at the end of the day, but don't want to shut them down if someone is logged in and working. The difference between the two scripts is that one would be run on the local machine(s) that you want to shut down, while the second script can be run from one computer and will attempt to shut down all computers in a specified Organizational Unit (OU). You can use the Task Scheduler to run either of these scripts at a specific time of the day or week.
Obviously, you could also cut out the parts that test to see if someone is logged on if you don't want or need that check
Both of these scripts use the Windows Management Instrumentation (WMI) service and should work on any version of Microsoft Windows from Windows 2000 up and possibly Windows NT, Windows 95, & Windows 98 with the WMI CORE 1.5 distributable.
Continue on for the VBS code...