Matching the BizTalk Service Name with its PID

I have been working with pipeline components quite a bit recently and when I try to attach to the BizTalk Server process I find that there are a lot of host instances and I need to determine which one to attach to.

If you run the tasklist utility from a command prompt it will enable you to get a list of the host instances (services) as well as the name and PID.  Exactly what we need to determine what to attach to.

If you have a 32 bit hosts then run the following:

tasklist /SVC /fi "imagename eq btsntsvc.exe"

and if you have 64 bit hosts then run this:

tasklist /SVC /fi "imagename eq btsntsvc64.exe"

the /fi is a filter and the eq is equals. 

The results that will come back will look something like

Image Name                        PID    Services
================== ==== ===============================
BTSNTSvc.exe                   6324    BTSSvc$BizTalkServerApplication
BTSNTSvc.exe                   3676    BTSSvc$BizTalkServerReceive
BTSNTSvc.exe                   6152    BTSSvc$BizTalkServerSend