Current Version: 2.0
ShutdownUnless is a utility to shutdown a workstation or server, provided it doesn’t have any open files/running processes you wouldn’t want to be open when shutting down. Optionally ShutdownUnless will write to the Windows NT event log, or email you, when a shutdown successful or aborted due to an open file or running process.
Purpose: Every sys admin knows sometimes you just need to restart a slow running Windows server to make it run more efficiently. The best practice is to schedule a shutdown/restart via Windows Task Scheduler to run at a pre-defined interval, usually at nights and/or on the weekends when server operation is not critical to the work environment.
You wouldn’t want to restart your server if some employee left a database dependent client app open on his/her workstation, because with the database stored on the restarting server, corruption may result; you’d rather abort!
If such a planned restart was aborted, you might even want this recorded in the event log (or emailed to you), with a list of the open files preventing your shutdown in the event description!
In my case, I needed to script an automatic server restart on a weekend due to maintenance. Problem is, all clients of a particular program needed to be closed, and you can’t guarantee that employees are shutdown their software before going home on Friday. (Sure, you could force the app to close on the workstation, but that may leave loose ends depending on the particular software that I’m not ready to deal with.)
My solution was ShutdownUnless. I schedule it with the Windows Task Scheduler just like any other method, but when it runs it tests the database file to see if any clients are currently accessing it prior to shutdown, if so then it aborts the restart operation, writes an entry to the Application Event Log, and emails me letting me know why the server didn’t restart.
Revision history: v2.0 – Completely rebuilt the entire application from the ground up.
- Added SMTP/Email functionality.
- Added running process detection with optional abort if a process is running.
- Added optional running process termination before a shutdown / restart operation.
- Added optional ability to stop services before a shutdown / restart operation.
System requirements: ShutdownUnless is designed for any version of Windows and has no requirements not already included in the installer package.
- Run the setup.
- Run the config, and test (config will run automatically after setup finishes.)
- Configure your shutdown batch/script or task via the Task Scheduler to run ShutdownUnless.exe with a -s parameter to shutdown or a -rparameter to restart. Here is a one line batch file example, which can be used in any shutdown script, which will restart if no files are in use. EX:
- %programfiles%Foolish ITShutdownUnlessShutdownUnless.exe -r
That’s it. Nothing more to do. Really.
- This software completely FREE for personal and commercial use under the terms of this license.
- This program is provided with no warranties or guarantees of any kind, and that you and only you are held as the bearer of sole responsibility for any use or misuse of this software and any resulting damages in any form, monetary or otherwise.