Ravindar, Biztalk Developer and Administrator

Just another BizTalk blog

Get Biztalk serviceInstance details with Powershell

To get all service instance details of Acitive/readytorun/suspended(resumable and non resumable), dehydreated, use following command

Get-WmiObject -Class "MSBTS_ServiceInstance" -Namespace 'root\MicrosoftBizTalkServer' | Where-Object { $_.Item -match "$Name" -and $_.Item -ne "" -and ($_.ServiceStatus -eq "1" -or $_.ServiceStatus -eq "2" -or $_.ServiceStatus -eq "4" -or $_.ServiceStatus -eq "8" -or $_.ServiceStatus -eq "16" -or $_.ServiceStatus -eq "32")  }

it will display all service instances with following details for every instance

Image

And if you want to know the count of all Biztalk application’s current Acitive/readytorun/suspended(resumable and non resumable), dehydreated messages, then use following command

$a=Get-WmiObject -Class "MSBTS_ServiceInstance" -Namespace 'root\MicrosoftBizTalkServer' | Where-Object { $_.Item -match "$Name" -and $_.Item -ne "" -and ($_.ServiceStatus -eq "1" -or $_.ServiceStatus -eq "2" -or $_.ServiceStatus -eq "4" -or $_.ServiceStatus -eq "8" -or $_.ServiceStatus -eq "16" -or $_.ServiceStatus -eq "32") } | measure
$a.Count

And if you want to get the number of service instance for a specific biztalk application, then use following, just replace the application name between the 2 star symbols in the parameter value for  Assembly name

$_.AssemblyName -like "*MyApplication*"

with your appropriate Biztalk application name

just similar to below

$a=Get-WmiObject -Class "MSBTS_ServiceInstance" -Namespace  root\MicrosoftBizTalkServer' | Where-Object { $_.Item -match "$Name" -and $_.Item -ne "" -and ($_.ServiceStatus -eq "1" -or $_.ServiceStatus -eq "2" -or $_.ServiceStatus -eq "4" -or $_.ServiceStatus -eq "8" -or $_.ServiceStatus -eq "16" -or $_.ServiceStatus -eq "32") -and $_.AssemblyName -like "*MyApplication*" } | measure

$a.Count
Advertisements

July 5, 2013 - Posted by | Powershell with Biztalk

No comments yet.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: