Configure Each Host to Send a Separate Email Notification Upon Completion of Patching

I’ve previously written about configuring email notifications in BatchPatch. You can find those postings here and here. However, today I’d like to focus on an aspect of email notifications that I have not yet discussed in much detail. Today the focus is going to be on the situation where you need or want to have each host trigger its own email notification at the end of a patching operation. The emails can be configured to all be sent to a single administrator or group of administrators, or you can even configure each host to send to a separate administrator or group, if desired.

  1. First please note that there are global settings and well as per-host settings for email notifications. If you want all hosts to send notifications in the same format and to the same recipients, then you can simply use the global settings without touching any of the per-host overrides. However, if you want to have emails be sent to different recipients per target host, then you would need to use the per-host overrides. We’ll get into that later. Start by examining your global email notification settings under ‘Tools > Settings > Email notifications’
  2. Fill out all of the form with the desired information. You’ll need to specify a ‘from’ email address as well as recipients, the SMTP server address and port and logon credentials, if needed. For the body format we recommend plain text PLUS ‘Include HTML Attachment’. For the body text we have a few options. BatchPatch has some built-in variables for email notifications, which help you to customize the notification format:
    • $host – Will print the host name from the row that initiates the email notification
    • $row – Will print the entire row contents from the row that initiates the email notification
    • $grid – Will print the entire grid contents for just the grid that contains the row that initiated the email notification
    • $allgrids – Will print the contents of all grids in the BatchPatch instance

    In this tutorial since our goal is to have each host/row generate its own email notification after applying updates, we’re going to have the email alert only contain the $row variable, so that each email notification that is sent only contains information about the particular row/host that triggered the email notification. So as you can see in the screenshot above, the body text field only has $row listed.

  3. Click the ‘Test email settings‘ button to make sure that BatchPatch is able to send a test email notification using the settings that you specified. If there is an error here during the test, it will need to be resolved before continuing.
  4. Now that the global email notification settings have been completed, it’s time to configure a job queue for each row. The idea here is that each row will execute a job queue that includes applying Windows Updates. As the last step in the job queue we include the ‘Send email notification’ instruction.
    Select the desired target hosts in the grid, and then click ‘Actions > Job Queue > Create/modify…’ Create your queue, and then apply ‘Send email notification’ as the last step in the queue, just like what you see in my screenshot below, and then save the queue.
  5. If you want or need any individual hosts/rows to send their email notifications to different recipients, then here you can optionally override the global/default email notification settings on a per-row basis, as needed. For example, let’s configure ‘host1’ in my grid with a new/different email recipient. I’ll select ‘host1’ and then ‘Actions > Email notifications > Override default email notification settings
  6. In the window that appears you can see that I have ticked the ‘Recipients’ box and then typed in a new recipient email address. When this row triggers an email alert, it will send the email to this address instead of the addresses listed in the global settings that we modified at the beginning of this tutorial.
  7. At this point you’re done. You can execute the job queue either on-demand or via a scheduled task. When the job queue completes, the last step it executes will be the email notification step. Each host/row that runs that job queue will send its own notification to the hosts defined in the global email notification settings, with the exception of host1, which will use the email recipient that was specified in the ‘Override default email notification settings’ window.
This entry was posted in Blog, General, Tutorials and tagged , . Bookmark the permalink. Both comments and trackbacks are currently closed.