Using the script given on http://msdn2.microsoft.com/en-us/library/bb203857.aspx, we can remove suspended messages, instances. But since suspended messages, service instances that are older than 7 days (a week) wont be of any use to us, we want to delete them automatically by running a script. The above script doesn't give us that option, how can we modify it or use some other way so that we are able to delete all suspended messages, service instances older than a week using a script that is scheduled to run every day.
I'd be curious to know *why* you're getting so many Suspended service instances that you need to run a script to remove them..
I'm assuming this is in Dev and not Production?
If you're getting lots of suspended service instances in production, you might want to solve the root cause of the problem, rather than the side-effect.
However, assuming that there's a valid reason I can think of 3 things to try:
1) Have a lot at this post: http://blogs.msdn.com/biztalk_core_engine/archive/2005/03/09/390996.aspx You can use the bts_CleanupMsgbox SPROC to remove all service instances from your MessageBox, but you really really don't want to run this on a Prod system.
2) if you look at what the VBS script is doing, it's just executing a series of T-SQL statements aginst the BizTalk MessageBox.So, you could create your own custom SPROC to do this, and care a SQL Agent to run this regularly.However, be careful about putting custom SPROCs in the MessageBox database: it's not supported by Microsoft so could either a) be overwritten by a new release of BTS or worse b) cause your system to be unsupported
3) Use something like WinAT to task schedule the VBS script to run regularly on a BizTalk box - no need to update the DB.
I'm sure others will have good suggestions as well.
Hope this helps,Cheers,
Thanks for the reply, but my problem is not of scheduling the script, it is only that 'How do I get the suspended instances older than a week?', because the current script just gets all the suspended instances and deletes them. I guess it is querying the BizTalk db using WMI api and I dont know the column names of TimeStamp in that to update the query in the script.
Answer to your first question, this will actually be implemented on Production, because no wonder what you do you'll have suspended messages and service instances, and if there is some thing to be done to them, that will be done within a week, so we dont need to pile up in the db and want to delete them afterwards.
In case anyone (other than me) is still looking for this....
Here is a link to a modified script which allows specifying minimum number of days old instances must be to be terminated. dl.dropbox.com/.../terminate.vbs