Samstag, 25. Februar 2012

Exchange Server 2007/2010 Fast Shutdown Script für den DC


-------------------------------</Script Start>-----------------------------


@ECHO OFF
@TITLE Reboot Exchange 2007 on DC script
@COLOR 1F
SETLOCAL

ECHO  ÉÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ»
ECHO  º                                                                            º
ECHO  º                       Script by Tayfun Tastan                              º
ECHO  º                    Updated on January, 2008                            º
ECHO  º                  *******************************                           º
ECHO  º                                                                            º
ECHO  º      This script will will reboot Exchange Server 2007 when installed      º
ECHO  º                       on a Domain Controller.                              º
ECHO  º                                                                            º
ECHO  º                        All Rights Reserved.                                º
ECHO  º                                                                            º
ECHO  ÈÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍͼ
ECHO.

ECHO.
ECHO 1. Shut Down the server (shutdown /s).
ECHO 2. Reboot the server (shutdown /r).
ECHO 3. Abort shutdown (shutdown /a).
ECHO 0. Do nothing.
ECHO.
CHOICE /C 1230

IF ERRORLEVEL 4 GOTO END
IF ERRORLEVEL 3 GOTO ABORT
IF ERRORLEVEL 2 GOTO REBOOT
IF ERRORLEVEL 1 GOTO SHUTDOWN
IF ERRORLEVEL 0 GOTO END
GOTO END

:ABORT
shutdown /a
GOTO END

:REBOOT
SET PARAMETERS=/r /c "Stopper - Rebooting server"
GOTO STOPSERVICES

:SHUTDOWN
SET PARAMETERS=/s /c "Stopper - Shutting down the server"
GOTO STOPSERVICES


:STOPSERVICES
ECHO ON
REM - While we are waiting for the main Exchange services to stop,
REM - Some peripheral services will be closed in the background.

start /min net stop Microsoft.Exchange.Pop3Service /yes
start /min net stop Microsoft.Exchange.Imap4Service /yes

:STOPSERVICES (only for E2K3)
:start /min net stop NntpSvc /yes
:start /min net stop SMTPSVC /yes
:start /min net stop MSExchangeMGMT /yes
:start /min net stop RESvc /yes


REM - Stop Exchange main services before shutdown to avoid timing conflicts.

net stop MSExchangeIS /yes
net stop MSExchangeADTopology /yes


:net stop Microsoft.Exchange.EdgeSyncSvc /yes
:net stop Microsoft.Exchange.AntispamUpdateSvc/yes
:net stop MSExchangeFDS /yes
:net stop Microsoft.Exchange.ServiceHost/yes
:net stop MSExchangeMailSubmission /yes
:net stop MSExchangeMailboxAssistants /yes
:net stop Microsoft.Exchange.Cluster.ReplayService /yes
:net stop Microsoft.Exchange.Search.ExSearch /yes
:net stop Mad /yes
:net stop MSExchangeTransport /yes
:net stop MSExchangeTransportLogSearch /yes
:net stop Microsoft.Exchange.Monitoring /yes



REM - Well, why not stop other services in the background just for fun?
REM - Stopping IISADMIN will stop other dependant services like W3SVC, and HTTPFilter (SSL).
start /min net stop IISADMIN /yes
start /min net stop msftesql-Exchange /yes
start /min net stop Spooler /yes

REM - Now it's time to reboot or shutdown the server.
shutdown %PARAMETERS% /t 10

REM To abort, type:
REM shutdown /a
:END


-------------------------------</Script End>-----------------------------


Natürlich gibt es keine Haftung und auch kein Support für diesen Code - Die Nutzung  ist auf eigene Gefahr!!!

Keine Kommentare:

Kommentar veröffentlichen