If you’re like me – working away…you’ll soon want to split up your solution into
multiple hosts.
Whether it be BTS2004 or 2006, there’s still a bit of ‘click, start/stop (or restart)’
for each host instance.
I’m on a project where we are looking to use 9 or so host instances….I decided to
write a script to do it. More like a batch file.
(go easy on my batch file skills….it’s been a LONG while since I’ve had to cut some
serious batch stuff)
Enjoy – saves heaps of time.
(copy and paste the following code into a file called ‘Restart_BTSHosts.bat’ for eg.)
@ECHO OFF
@REM =======================
@REM Mick Badran 2006
@REM
@REM Checks the BizTalk Hosts and restarts them
@REM
@REM possible improvements – to be able to select
@REM BTS Hosts with wildcards.
@REM =======================
@ECHO Restarting ALL BizTalk Hosts 2004/2006 from the command line.
@ECHO.
@ECHO.
@SET TEMPFILE1=”%TEMP%\bts1.txt”
@REM this line looks through the installed services and pulls out matching ones to
BTSSvc (could be any though)
@SC QUERY | FindSTR “BTSSvc” > %TEMPFILE1%
@ECHO. Stopping BizTalk Host Instances…
@FOR /F “tokens=2” %%s in (‘TYPE %TEMPFILE1%’) DO SC STOP %%s
@ECHO.
@ECHO. Starting BizTalk Host Instances…
@FOR /F “tokens=2” %%s in (‘TYPE %TEMPFILE1%’) DO SC START %%s
@ECHO.
@DEL %TEMPFILE1%
@ECHO Done….. 🙂