Listing BTS Adapters with Powershell

Link. September 26, 2006. Comments [0]. Posted in: BizTalk | PowerShell

This sample script will list all installed adapters in your local BizTalk Server, including the names of configured send and receive handlers for them:

#
# Helper function to list all WMI objects of
# a given type
#
function bts-list-objs($kind)
{
   get-wmiobject $kind `
      -namespace 'root\MicrosoftBizTalkServer'
}

#
# get objects related to an adapter
#
function bts-get-related($adapterName, $kind)
{
   get-wmiobject $kind `
      -namespace 'root\MicrosoftBizTalkServer' `
      -filter "AdapterName='$adapterName'"
}

#
# dump adapter information to the console
#
function bts-show-adapter($adapter)
{
   '--- ' + $adapter.Name + ' ---'
   $sendHandlers = @(bts-get-related $adapter.Name MSBTS_SendHandler2)
   if ( $sendHandlers.Length -gt 0 )
   {
      'Send Handlers:'
      for ( $i =0; $i -lt $sendHandlers.Length; $i++ )
      {
         '   ' + $sendHandlers[$i].HostName
      }
   }
  
   $recvHandlers = @(bts-get-related $adapter.Name MSBTS_ReceiveHandler)
   if ( $recvHandlers.Length -gt 0 )
   {
      'Receive Handlers:'
      for ( $i =0; $i -lt $recvHandlers.Length; $i++ )
      {
         '   ' + $recvHandlers[$i].HostName
      }
   }
   ''
}

#
# main script
#
bts-list-objs MSBTS_AdapterSetting | %{ bts-show-adapter $_ }

Here's a sample output of running the script:



Comments are closed.

About

Tomas Restrepo is a software developer located in Colombia, South America. His interests include .NET, Connected Systems, PowerShell and lately dynamic programming languages. More...

tomasrestrepo @ twitter My Flickr photostream My saved links on delicious My Technorati Profile

email: tomas@winterdom.com
msn: tomasr@passport.com

View my profile on LinkedIn

MVP logo

Syndicate

Ads


Links

Categories

Statistics

Total Posts: 1020
This Year: 90
This Month: 9
This Week: 0
Comments: 791

Blogroll

Post Archive

Other

Copyright © 2002-2008, Tomas Restrepo.

Powered by: newtelligence dasBlog 2.1.8102.813

Sign In