Beyond Logic Shutdown for NT/2000/XP 

The Windows 2000 Professional Resource Kit and Windows XP introduce a shutdown.exe command line utility to shutdown local and/or remote computers. This utility can be used in conjunction with the task schedular or AT service to shutdown computers after hours to help conserve power (money, and the environment) or to reboot your computer after hours to make it more reliable. 

However a quick play with these utilities will fine that they are less than adequate. First, they provide limited options to shutdown, reboot or logoff. However shutdown does not actually turn your ACPI compliant computer off but rather displays the “It is now safe to turn off your computer” message. There is no recourse for the user to cancel the operation, or an opportunity to target idle computers without logged on users. 
  
The limited and bland dialog from standard Microsoft Utilities using InitiateSystemShutdown API. 

The Beyondlogic shutdown utility on the other hand provides : 

Options to shutdown, power-off, reboot, suspend, hibernate, log-off or lock the workstation. 
Actually shutdowns ACPI Compliant computers including WinNT4 with the hal.dll.softex Hardware Abstraction Layer. 
Ability to display optional message of a maximum 300 characters. 
The shutdown dialog will appear on the active window, should it be the login window, login screen saver, logged in user's desktop, or on a locked workstation. 
Option to allow the user to cancel the operation. (This can be greyed out) 
Option to prevent shutdown action occurring on logged-on computers giving your users the flexibly to run lengthy processes overnight without being disturbed. 

 
The beyondlogic shutdown dialog, giving your users the option to cancel your action

This utility is based on the shutdown module of the popular beyondexec. If you need to shutdown multiple computers it is recommended to use beyondexec 


Usage 
Using the industry standard /? switch will show the utilities parameters. A summary is shown on the right. 

Without any switches specified, a cancellable shutdown action with a 60 second countdown will be selected. Windows 2000 and XP users should always use the shutdown switch to turn off your computers. The PowerOff switch is only provided to shutdown Windows NT4 with the softex hardware abstraction layer installed. (See more details below) 

The -c switch can be used to Gray out the cancel button preventing users from cancelling the shutdown once initiated. The -i switch first checks to see if the shell (explorer.exe) is running to establish if a user is logged into the workstation. If a user is logged in, the application exits without displaying anything. This can be used to give you users the freedom to run programs on the PC overnight or can be used to only shutdown idle machines while not annoying users logged in and working away. 
   



Scheduling a Shutdown on Windows NT/2000/XP 
Windows 2000 and XP contains a GUI task scheduler. However this scheduler doesn’t provide the option to allow processes the right to interact with the desktop. Therefore you need to use the AT service bundled with NT4/2000 and XP instead. 

C:\ at 18:00 /interactive /every:M,T,W,Th,F,S,Su c:\windows\shutdown.exe -i -l 600 
 -m “Management acknowledges your dedication to your work. However if you choose to 
  go home now and have a good night, you will be much more productive tomorrow.”

The above example shows how you can schedule a shutdown to occur at 6:00pm each night. In this example shutdown.exe has been copied to c:\windows (Windows XP). 

In medium workgroups and larger organisations, the above solution requires shutdown.exe to be copied to all your computers and the scheduler set up on each computer. Each computer will then shutdown based on it's own system clock. While many sites sync the workstation clock at log-in, flat CMOS batteries can be a problem for those sites who don't. It can also be a large task to change the configuration should you need to reschedule around an event. 

Another solution is the popular beyondexec which can be used to run processes or shutdown multiple workstations on a single or group of remote workstations. In this case you could run a single scheduled task on a NTP sync'd server to shutdown your group of computers. If you need to change the scheduled time there is only one setting to change, and it gives you the flexibility to shutdown the workstations on demand such as moments before a scheduled power outage. The other advantage is there is absolutely nothing you have to install on your remote computers. 

Trouble Shooting 
Powerdown on Windows NT 4 / Soft-Off 
Windows NT 4 can be made to switch itself off after shutdown should your computer supports power management. When Service Pack 6/6a is extracted you will find a hal.dll.softex file. If you replace \winnt\system32\hal.dll with a copy of this file, using -d poweroff with beyondexec will shutdown and poweroff your ACPI Windows NT 4 Workstation. Failure to replace the hal.dll will result in the poweroff action rebooting your Windows NT computer. 

Locked Workstations 
When a workstation is locked, the shutdown, reboot and logout actions will not function correctly unless the -f (force applications to terminate) switch is specified. The suspend and hibernate actions will function correctly on a locked workstation. This is a problem associated with the ExitWindowsEx() API provided in Windows. 

Download 

Version 1.01, 18K bytes. (Freeware) 


Revision History 
16th November 2003 - Version 1.01 
First release to public. Extracted the shutdown module from BeyondExec for standalone use.  
