POWEROFF V2.0

Created by Jorgen Bosman, 1999-2001 in Belgium!
This is FREEWARE
e-mail: jorgen.bosman@pandora.be


Poweroff is a small program for Win95/98/NT/W2K
to schedule a shutdown/reboot/logoff/poweroff at a certain time.


You can only do a poweroff if your PC is a ATX and if it supports
software poweroff.
In Win98, a poweroff is the same as a shutdown.


In order to do a poweroff in WinNT 4.0, you will need a hal.dll
that is capable of shutting down your workstation. 
You can try one that's supplied with service pack 4 (or 5): hal.dll.softex
- Just extract the service pack (with the /x option),
- Rename the x:\winnt\system32\hal.dll to x:\winnt\system32\hal.dll.sav,
- Copy the hal.dll.softex to x:\winnt\system32\hal.dll
- Reboot
- If you like NT to automatically poweroff at shutdown,
  set the follwing registry key to 1:
  HKEY_LOCAL_MACHINE\Software\Microsoft\Windows NT\CurrentVersion\Winlogon\PowerdownAfterShutdown


In Windows 2000, poweroff should be natively supported. 
Make sure you have the latest BIOS version and that power settings are enabled in the control panel.
(Windows 2000 should poweroff your machine when you do a normal shutdown with windows)


You can use poweroff to do a reboot/shutdown on a remote NT/2000 system
(logoff and poweroff are not supported by windows :( )
Just select Remote computer and type in the name of the remote computer ('\\' not required)
(or the ip adress)
You need to have permission on the remote machine to do a
remote shutdown. On NT, you can give this permission in the
'User Manager' tool, in the 'Policies' Menu item.
On 200, you can grant this permission in the 'Administrative Tools'
folder in the control panel, by starting the 'Local Security Policy' tool.


You can use poweroff in batch files by using the command line parameters.
Usage: poweroff [poweroff|shutdown|reboot|logoff] [seconds_to_wait|hh:mm] [options]
Options:
  -f        : Force termination of all programs
  -w n      : Wait n seconds on startup before checking the time
  -r machine: Perform an action on a remote machine
  -warn     : Give a warning dialog box before peforming the action
  -m message: Specifies the message in the warning dialog box
  -t n      : Display the warning dialog box for n seconds (default = 20)

You must specify an action to perform and optionally how many seconds to wait
before doing the action. You can also specify a time when the program must perform the action
like this: hour:minute (hh:mm) in 24 hour format
If -f is specified, then it does a force terminate of all running applications.
If -w is specified, then it waits some time (the seconds you specify) before checking the time.
This allows you to reboot your pc each day at a certain time but to prevent rebooting 2 times
if your pc reboots within one minute.
If -r is specified, then you can reboot or shutdown a remote machine by specifying the
machine name. e.g.: ws001 or 10.0.0.1 or \\ws001
If -warn is specified, then a warning dialog box is displayed for a number of seconds (default 20)
before the real action is performed on the local or remote computer.
If -m is specified, then the specified message is displayed inside the warning dialog box,
There is a default message, so this parameter is optional.
If -t is specified, the the warning dialog box is displayed for the specified number of seconds.
Default is 20, so this parameter is optional.

examples: 
- poweroff poweroff                  : powers off your pc right now.
- poweroff reboot 20                 : rebootds your pc in 20 seconds
- poweroff logoff -f                 : logs of the current user and stops all applications without notification
- poweroff poweroff 22:05            : powers off your pc at 22:05 (=10:05pm for you americans)
- poweroff poweroff 31/12/2000:23:59 : Powers off your pc at 1 minute before newyear
- poweroff reboot 13:45 -w 120       : Reboots at 13:45 but wait 2 minutes before checking the time.
- poweroff shutdown -r jb -warn -t 60: Shutdown the remote computer jb, warn the user for 60 seconds.
- poweroff reboot -warn -m "Your PC will be rebooted ,please save all your work NOW"


To schedule poweroff in NT/2000 you can use the 'at' command (in a DOS box):
at 23:00 /every:m,t,w,th,f,s,su c:\poweroff\poweroff.exe poweroff -f

To schedule poweroff in W95/98, create a shortcut in your startup folder to:
c:\poweroff\poweroff.exe poweroff 23:00

Or alternatively, you can create a REG_SZ value in you registry under:
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Run
called Poweroff, with value c:\poweroff\poweroff.exe poweroff 23:00

These examples assume that you have poweroff.exe installed in the c:\poweroff directory
and that you want to power off your pc at 23:00 each day.




Change History:

V2.0: 14-04-2001
 - Added remote shutdown/reboot
 - Add warning dialog

V1.3.3: 15-03-2001
 - Added the command line option -w

V1.3.2: 12-12-2000
 - Added the command line option to specify a date (dd/mm/yyyy:HH:MM)

V1.3.1: 28-11-2000
 - Added event logging on NT/2000

V1.3: 19-05-2000
 - Added command-line option to specify a certain time (hh:mm)

V1.2: 03-03-2000
 - Added command-line paramters, so that you can use poweroff in batch files

V1.1: 27-05-1999
 - Added a date field
 - Added the current date and time
 - Added the Now button to immediately do the required action
 - Hide now adds an icon to the system tray. Doubleclick the 
   icon to bring the screen back up.
 - Added a force checkbox. If checked, all applications terminate without warning.
 - Changed the format of the time to hh:mm:ss
 - The format of the date field is dd/mm/yyyy
 - Poweroff now also appears in the taskbar

V1.0: 08-05-1999
 - First release