Blogging BizTalk

Lets Discuss BizTalk

Using Shell Script/WMI Script To Automate : BizTalk


So I was rather placed with this unique situation where In I had to automate the termination of Routing failure reports due to some business requirement.

How Do We Do That?

1st Approach:

1>Write a wmi script to terminate the suspended instance (Or whatever you wish to).

2> Call that in a batch file.

3>Have that batch file called in from windows scheduler.

Problem: In case you are running BizTalk server 2006 R2 chances are you might run into into following error:

The COM+ Services DLL (comsvcs.dll) was unable to load because allocation of thread local storage failed.
Process Name: wmiprvse.exe
Error Code = 0x80070008 : Not enough storage is available to process this command.
COM+ Services Internals Information:
File: d:\nt\com\complus\src\comsvcs\comsvcs\comsvcs.cpp, Line: 334
Comsvcs.dll file version: ENU 2001.12.4720.3959 shp

This is a known Microsoft issue and you need this patch for your WMI to work.

http://support.microsoft.com/kb/2431466

2nd Approach

Write a Powershell script.Copy the script file and paste it to your local file system, for example C:/

2>Right click on YourScript.ps1 and pick edit.

3>type in Set-ExecutionPolicy Unrestricted in the prompt and confirm yes.

4>Type in Get-ExecutionPolicy and check if the result is unrestricted.

5>Open the windows scheduler
Start>> All Programs>>Accessories>>System Tools>>Scheduled Task

6>Create a new task after clicking on “Add Scheduled Task”.

Pick powershell in the list of the first modal window you get
On the run paste following: C:\Windows\system32\WindowsPowerShell\v1.0\powershell.exe -File C:\YourScriptName.ps1

Shell Script:

Get-WmiObject MSBTS_ServiceInstance -namespace ‘root\MicrosoftBizTalkServer’ -filter ‘ServiceClass = 64’ |`
%{Get-WmiObject MSBTS_ServiceInstance -namespace ‘root\MicrosoftBizTalkServer’ -filter “InstanceID = ‘$($_.InstanceID)'”} |`
%{ $_.Terminate()} |`
%{ Out-Null }

Advertisements

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 Goins Insperience

Technological outformation for this day and age

[INACTIVE BLOG] Connected Thoughts - Thiago Almeida

Connected systems and the occasional picture

Uri Katsir's Blog

BizTalk , BizTalk RFID and .NET

prashantbiztalkblogs

My BizTalk Experiences

BizTalk Server Tutorial

BizTalk Server Concepts and Common Errors

Extremely Talented Monkeys

A Technical Blog by Ed Jones: Azure, .NET, BizTalk, WCF, and SQL Server

On All Things Web

Discussing web development without limits

Vikas Bhardwaj's Blog

Articles about BizTalk Server and .NET C#

Cloud develop

a blog about (cloud) development... because I'm a nerd

Hooking Stuffs Together

My learning logs from day to day work experience about Integration platform using Microsoft technologies.

Connected Pawns

Mainly BizTalk & Little Chess

jhelatissimo

a blogger in the process.

MS Innovations Blog

Tips, Tricks, and Workarounds for BizTalk and other Microsoft technologies

srirambiztalks

Katradhu Kaialavu,Kalladhadhu Ulagalavu!

Vijay Microsoft Technical

BizTalk, WCF, ESB ToolKit, Windows Azure

Mind Over Messaging

Musings on BizTalk, Azure, WCF, and Enterprise Integration

%d bloggers like this: