BizTalk DevOps: Monitor your BizTalk environment using PowerShell –Event Viewer BizTalk related Errors

One of the principal needs for BizTalk Administrators is the ability to monitor the health of BizTalk environments on a regular basis and react promptly to solve any possible issues that may appear in order to keep your BizTalk Server applications accessible to your users/organization.

You can accomplish this by using certain tools such as BizTalk Administration Console; BizTalk360; SCOM and many more… However, unfortunately, many times, some of these tools are not available for us but we still need to accomplish this task.

However sometimes we don’t have access to some of these tools and in this case, PowerShell is a good way to address and implement some of the basic monetization tasks or even complement and extend the existing tools.

Now I’m playing a little with PowerShell… following my last post and the series “Monitor your BizTalk environment using PowerShell”.

So how can PowerShell help us?

BizTalk Server writes all errors that occur in the environment in the Event Viewer Application Log.

It is important that you maintain this log clean of noise (custom application errors, warnings of information that you can use inside your code)

With this script, you can be able to monitor the Event Viewer for BizTalk Server related errors

This script allows you to set:

  • The timeframe that you want to monitor, the Entry Type and the Sources
$getEventLog = Get-Eventlog -log application -after ((get-date).AddHours(-4)) -EntryType Error | Where-Object {($_.Source -eq 'BizTalk Server')}
  • And configure your email notification settings
 Set mail variables
 [STRING]$PSEmailServer = "smtp"
 [STRING]$Subject = "BizTalk Job Monitor"
 [STRING]$From = ""
 [array]$EmailTo = ("")
 if($count -gt 0)
     #Send mail
     foreach ($to in $EmailTo)
         $Body = $HTMLmessage
         $SMTPClient = New-Object Net.Mail.SmtpClient($PSEmailServer)
         $message = New-Object Net.Mail.MailMessage($from, $to, $Subject, $Body)
         $message.IsBodyHtml = $true;

Report sample:

BizTalk Server Event Viewer monitor

Note: This type of script must be viewed as a complement to the tools mentioned above or used in the absence of them.



You can download Monitoring Event Viewer Errors in your BizTalk environment with PowerShell from GitHub here:

Author: Sandro Pereira

Sandro Pereira lives in Portugal and works as a consultant at DevScope. In the past years, he has been working on implementing Integration scenarios both on-premises and cloud for various clients, each with different scenarios from a technical point of view, size, and criticality, using Microsoft Azure, Microsoft BizTalk Server and different technologies like AS2, EDI, RosettaNet, SAP, TIBCO etc. He is a regular blogger, international speaker, and technical reviewer of several BizTalk books all focused on Integration. He is also the author of the book “BizTalk Mapping Patterns & Best Practices”. He has been awarded MVP since 2011 for his contributions to the integration community.

1 thought on “BizTalk DevOps: Monitor your BizTalk environment using PowerShell –Event Viewer BizTalk related Errors”

  1. Very usefull script for event handling thnx..

    In pshell script you should use $log instead of $getEventLog for avoid looping.

Leave a Reply

Your email address will not be published. Required fields are marked *


Back to Top