Shutdown_reboot.cmd to speed up the rebooting

Rating: No reviews yet
Downloads: 163
Released: Jan 14, 2010
Updated: Jan 15, 2010 by Bitzie
Dev status: Stable Help Icon

Recommended Download

Source Code shutdown_reboot.cmd
source code, 2K, uploaded Jan 15, 2010 - 163 downloads

Release Notes

This is a batch file to shut down and reboot the SBS server.

Put in the system32 directory so they're on your path

You will also need to download the shut down exchange script from
http://sbs.codeplex.com/Release/ProjectReleases.aspx?ReleaseId=38792 and http://sbs.codeplex.com/Release/ProjectReleases.aspx?ReleaseId=38794 that download site to complete the script.

@echo off
@REM ****************************************************************
@REM Batch file to shut down and reboot the SBS server. For when it's
@REM mis-behaving. Calls stopexch.cmd, then uses shutdown -r -t 5
@REM
@REM Requires a separate stopexch.cmd and sleep.exe from the
@REM Server 2k3 RK.
@REM
@REM Possible enhancements:
@REM Use command line parameters to control wait times and
@REM shutdown warning commands.
@REM
@REM Modified: 23/04/2009 -- pick up server name from env
@REM : 27/10/2009 -- second date/time stamp after exchange
@REM
@REM ****************************************************************


@REM Ignore any sleep errors if you don't have a copy of sleep on this
@REM machine. It's not critical, just for neatness.
@REM

SET LOGFILE=C:\Shutdown.log
SET WARNING=5
SET SLEEP=2
SET STOPEXCH=%WINDIR%\system32\stopexch.cmd

@echo Automatic reboot %COMPUTERNAME% initiated...
@echo.

echo ===================================================================== >> %LOGFILE%
echo. >>%LOGFILE%
echo Automatic reboot of %COMPUTERNAME% initiated at: >> %LOGFILE%
date /t >> %LOGFILE%
time /t >> %LOGFILE%
echo. >>%LOGFILE%
echo Calling exchange shutdown script to speed things up >> %LOGFILE%
@echo Calling exchange shutdown script first...
@echo.

@REM The exchange shutdown is quiet. Probably too quiet.
sleep %SLEEP%
call %STOPEXCH% 1>&2 >> %LOGFILE%

echo. >>%LOGFILE%
echo Exchange should be stopped now... >> %LOGFILE%
@echo Exchange should be stopped now, initiating final shutdown...
date /t >> %LOGFILE%
time /t >> %LOGFILE%
echo. >>%LOGFILE%
@echo.
echo. >>%LOGFILE%
echo. >>%LOGFILE%
echo Now, shutting down the server using the command: >> %LOGFILE%
echo 'shutdown /r /t %WARNING%' >> %LOGFILE%
@echo Shutting down in %WARNING% seconds...
shutdown /r /t %WARNING% >> %LOGFILE%

Reviews for this release

No reviews yet for this release.