This is such a common task on BizTalk Server that I have already forgotten how many times I did it. Depending on several scenarios, like:
- Testing.
- Certain parts of the application are not yet ready to production.
- Or even discarded unwanted messages.
We want/need to create a send port and subscribe to specific messages to be discarded in a folder. Otherwise, they will get stuck on the administration console, and we don’t want that.
📝 One-Minute Brief
Use a PowerShell script to delete discarded BizTalk messages from local folders to prevent slowdowns and avoid disk space issues.
After a while, the problem is that the folder will get a considerable amount of messages, and writing a large number of files to disk will get progressively slower as the number of files in the target directory gets large. This is because your computer’s operating system must keep track of all files in a directory. Even bulk deleting all of these files will take a longer time. Moving or deleting files from the target directory on a regular basis will ensure that the performance is not adversely affected.
A large number of small files makes more impact than a small number of large files, and most of the time, BizTalk Server consumes/produces small messages. However, at some point, you may completely fill the hard drive, which is more critical.
With this script, you can easily configure the folders and the type of files you want to monitor and delete.
Get-ChildItem -Path C:\Temp -Include *.* -File -Recurse | foreach { $_.Delete()}
This will help BizTalk Administrators to take full control of their environments
Download
THIS POWERSHELL SCRIPT IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND.
You can download the Delete Discarded messages from local folders PowerShell script from GitHub here:
Hope you find this helpful! If you liked the content or found it useful and would like to support me in writing more, consider buying (or helping to buy) a Star Wars Lego set for my son.