Skip to main content
Skip table of contents



Case: Use of Powershell in a Monitor

Temporary files that gets stock

We have a Biztalk file-receive adapter, which reads files from a file share.
When the file-receive adapter reads a file from the file system, it starts by giving the file a temporary extension (eg d2bb82d.XLD.BTS-WIP)
If the file system goes offline while Biztalk is reading a file, the file can end up as a temporary file, which never gets picked up by Biztalk after the file system comes online again.
The solution is to rename the file back to the original name by deleting the temp extension.
This can be automated by Monitor Item Type Powershell and Monitor Item Action Script.

A relatively simple solution would be to use the Monitor Item Type Powershell.
Create a script that examines if files with .EdiPortalWeb is more than x hours old. If yes, rename and return a warning. The monitor will then show a warning until the next time the monitor is running, where it will turn green again. That way there will be a history of warnings, where you can see how often it has renamed files. You can also set the script to return OK and then you just do not discover that files have been renamed.

A more complicated solution is to use both Monitor Item Type Powershell and Monitor Item Action Script, so you have to create two scripts.

A script that examines if there are old .EdiPortalWeb and  if there are old files then return Error(2). When returning error, Monitor Item Action Script will run and rename the old temp-files. Here is an opportunity where you can say that the first three times within an hour, it is okay to run Monitor Item Action Script that renames the oldfiles, but if there comes a time within an hour then it will stop running the renaming script and the monitor goes in red. These solution sets a limit so we don't run our rename scripts unlimited number of times in a total collapse scenario.

Content on this page:

JavaScript errors detected

Please note, these errors can depend on your browser setup.

If this problem persists, please contact our support.