Upcoming DevLive Sessions http://blogs.msdn.com/b/biztalknotes/archive/2013/08/02/upcoming-devlive-sessions-for-biztalk.aspx
In Part I of this article, we discussed about saving suspended messages using WMI and a fairly simple PowerShell script. The problem with that approach is that it works great as long as your suspended orchestration instances don’t contain multiple suspended messages. If your suspended orchestration instances have more than asingle message, the script above only retrieves one of the messages. This behavior may change with the rollout of a BizTalk hotfix. But, until then, the workaround is to use a different approach.
For this solution, we used a .NET assembly that does most of the heavy lifting. The methods exposed by this assembly were then called from the PowerShell script we used in Part I of this sample (with a minor tweak). You need to add references to the following assemblies in the .NET class - Microsoft.BizTalk.Operations, Microsoft.BizTalk.Pipeline (both should be available in the GAC on a machine that has BizTalk installed).
The trick used here is that the WMI caller script supplies the suspended instances one-by-one to the .NET assembly, which in turn spits out all the suspended messages for that instance. In this solution, you get all the suspended messages for a service instance, and not just a single message you get in a purely WMI solution.
Usage : To use this script, save the .ps script and the helper .NET assembly (say at the path - C:\script\Save_Suspended_msgs.ps1 ), and run this from the PowerShell command prompt: PS C:\Users\Administrator> C:\script\Save_Suspended_msgs.ps1 -action save "c:\temp\Suspended_msgs"
And lo and behold, your messages appear in the folder that you provided in the command window!
This would create separate folders for each suspended instance type under the ‘Suspended_msgs’ folder specified above. So, if you have suspended instances for two different Orchestration types, it would create folders named after those Orchestrations and save out the messages in their respective folders.I am providing the script folder I used for testing this (contains the .NET assembly and the PowerShell script). Also, if you want to look into the .NET helper class, I am providing the .NET Visual Studio solution as well (built on VS 2010).
Have fun !
Written ByArindam Paul Roy
Reviewed ByChirag Pavecha
Microsoft India GTSC