Just a little note for myself this one.
At one of my customers where it is still BizTalk 2006 one of the build servers is intermittently getting issues so I wanted to run a script periodically to clean things up a little. The below script is an example of how you can stop cruise control and all of the biztalk services, then clean the biztalk databases and reset the backup process and then click everything off again.
This should keep the server a little cleaner and reduce the number of builds that occasionally fail for adhoc environmental issues.
REM Server Clean Script
REM ===================
REM This script is ran to move the build server back to a clean state
echo Stop Cruise Control
net stop CCService
echo Stop IIS
iisreset /stop
echo Stop BizTalk Services
net stop BTSSvc$<Name of BizTalk Host>
<Repeat for other BizTalk services>
echo Stop SSO
net stop ENTSSO
echo Stop SQL Job Agent
net stop SQLSERVERAGENT
echo Clean Message Box
sqlcmd -E -d BizTalkMsgBoxDB -Q "Exec bts_CleanupMsgbox"
sqlcmd -E -d BizTalkMsgBoxDB -Q "Exec bts_PurgeSubscriptions"
echo Clean Tracking Database
sqlcmd -E -d BizTalkDTADb -Q "Exec dtasp_CleanHMData"
echo Reset TDDS Stream Status
sqlcmd -E -d BizTalkDTADb -Q "Update TDDS_StreamStatus Set lastSeqNum = 0"
echo Force Full Backup
sqlcmd -E -d BizTalkMgmtDB -Q "Exec sp_ForceFullBackup"
echo Clean Backup Directory
del E:\BtsBackups\*.* /q
echo Start SSO
net start ENTSSO
echo Start SQL Job Agent
net start SQLSERVERAGENT
echo Start BizTalk Services
net start BTSSvc$<Name of BizTalk Host>
<Repeat for other BizTalk services>
echo Start IIS
iisreset /start
echo Start Cruise Control
net start CCService