I’m a nightmare for actually getting around to writing scripts to save me time; I have a list as long as my arm J   

This script is dead simple and largely based on samples from Script Center, which if you haven’t seen it is a goldmine of scripts for virtually any Windows task you can imagine – and is great for forming the basis of scripts.

This script is particularly useful when you have a farm of BizTalk servers and want to reset them prior to starting a performance test for example, the script will also handle stopping any extra BizTalk hosts you may have deployed (to host Adapters, etc.)

The script could of course take command line parameters and be prettier but they’re functional and you can always add that stuff J  

Double click it from explorer and the way you go!

 “BounceBizTalkFarm.vbs”

Dim strComputerList(3)
strComputerList(0) = "BTSServer1"
strComputerList(1) = "BTSServer2"
strComputerList(2) = "BTSServer3"
strComputerList(3) = "BTSServer4"

For Each strComputer in strComputerList

          Set objWMIService = GetObject("winmgmts:" _
                    & "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")

          WScript.Echo "Stopping BizTalk on: " & strComputer

          Set colServiceList = objWMIService.ExecQuery _
                     ("Select * from Win32_Service where Name LIKE 'BTSSvc%'")

          For Each objService in colServiceList
                    errReturn = objService.StopService()
          Next

          WScript.Echo "Starting BizTalk on: " & strComputer

          For Each objService in colServiceList
                    errReturn = objService.StartService()
          Next

          WScript.Echo
Next