How to stop a ALL BizTalk services with a vbs script
For a improved versión see the post https://blogs.msdn.com/b/amantaras/archive/2014/10/16/extended-vbs-to-start-stop-all-biztalk-host-instances-in-several-servers.aspxfor
This basic script is using vbs to stop all BizTalk services in the running server. It will loop searching for all windows services starting by ‘'BTSSvc%’
It asks for confirmation before stoping all
' VBScript Restart Service.vbs
' Sample script to Stop or Start a Service
' it stops all BizTalk services in the strComputer parameter
' Created by Agustín Mántaras Sept 2014
'
' -------------------------------------------------------'
Option Explicit
Dim objWMIService, objItem, objService, str
Dim colListOfServices, strComputer, strService, intSleep
strComputer = "." 'param
intSleep = 15000
WScript.Echo " This script will stop all BizTalk Host Instances"
Str = Inputbox("This will stop all the BizTalk Platform. are you sure? Write Y (UPPER CASE), if you agree. ", "BizTalk Environment will Stop processing")
if Str = "Y" Then
'On Error Resume Next
' NB strService is case sensitive.
strService = " 'BTSSvc%' "
Set objWMIService = GetObject("winmgmts:" _
& "{impersonationLevel=impersonate}!\\" _
& strComputer & "\root\cimv2")
Set colListOfServices = objWMIService.ExecQuery _
("Select * from Win32_Service Where Name like "_
& strService & " ")
For Each objService in colListOfServices
objService.StopService()
WScript.Echo "The "& objService.Name & " service has been Stopped"
Next
else
WScript.Echo " ++++++++YOU DID NOT AGREE +++++++++"
end if
WScript.Quit
Enjoy it!