PowerShell and RSS Feeds: Creating an Alerting Script


I’ve run into an issue where our Antivirus Vendor, Trend Micro, is unable to provide a service where we are emailed notifications of product service packs, patches, critical patches, repackaging of packages, etc. They also don’t have a notification process for when any of those are taken off their download site entirely due to bugs that are causing high impact across their customers. It looks like I’m going to use PowerShell to monitor the Download Center.


There is a huge flurry of RSS feeds associated with Trend’s website — along with most of the internet. How about sending an email whenever something is added/modified/removed, if it is in relation to a product we support? Perfect! I ended up creating a scheduled script to do all of the work for me.

He is the code to grab RSS information for Control Manager (TMCM), Server Protect for Network Appliance Filers (SPNAF), OfficeScan (OSCE), and SPS (Smart Protection Server):

# Grabbing all RSS feeds for supported products
[xml]$SPSrss = Invoke-WebRequest http://downloadcenter.trendmicro.com/pull/feed/product/1103
[xml]$OSCErss = Invoke-WebRequest http://downloadcenter.trendmicro.com/pull/feed/product/5
[xml]$TMCMrss = Invoke-WebRequest http://downloadcenter.trendmicro.com/pull/feed/product/7
[xml]$SPNAFrss = Invoke-WebRequest http://downloadcenter.trendmicro.com/pull/feed/product/18

You can find the feed links by first finding the specific product on this list, and clicking on the link. What you’ll see will be XML content, with your target link right in the open. Here is an example, using OfficeScan:

OfficeScan-RSSStore that into an XML variable, as shown earlier, and you can now dive into the details. I wanted any and all changes being done to products for the specific versions I support. I do this to grab specific information:

# Parsing only specific information
$AllTrendItems = $SPSrss.SelectNodes('//item') | 
  Where-Object {$_.Version -like 2.6 -or $_.Version -like 3.0} | 
    Select-Object Create_Date,Product,Version,Title,File_Type
$AllTrendItems += $OSCErss.SelectNodes('//item') | 
  Where-Object {$_.Version -like 10.6} | 
    Select-Object Create_Date,Product,Version,Title,File_Type
$AllTrendItems += $TMCMrss.SelectNodes('//item') | 
  Where-Object {$_.Version -like 6 -or $_.Version -like 5.5} | 
    Select-Object Create_Date,Product,Version,Title,File_Type
$AllTrendItems += $SPNAFrss.SelectNodes('//item') | 
  Where-Object {$_.Version -like 5.8} | 
    Select-Object Create_Date,Product,Version,Title,File_Type

On a first run, the script will just generate an XML file to be used as a reference for change during later scheduled runs:

$AllTrendItems | Export-CliXml Trend-Reference.xml

Here is some example output of the RSS feed information for OfficeScan:

OfficeScan-Object-InfoMy script uses Compare-Object to checkout the differences between the XML I generated, and the current RSS feed results. Based on the differences, I am able to know what has been added/removed/repackaged! If changes are found, I generate a time-stamped change log with the information. I use the code below to send the email:

$MailTo = "myaddress@work.com"
$MailFrom = "trendproductalert@work.com"
$Relay = "smtprelay.work.com"
$Subject = "Trend Micro Products: A Change Has Been Made"
$Message = "ALERT: A change has been discovered in the product listings for Trend Micro. Please see attached: $ChangeLog"
Send-MailMessage -To $MailTo -From $MailFrom -Subject $Subject -Body $Message -SmtpServer $Relay -Attachments $ChangeLog

These are just snippets of the code. You can take a look at the full script on TechNet right here, or when using the Script Browser for ISE. I originally started this off by referencing this article posted by the Scripting Guys. Also, I finally looked up on how to properly embed my PowerShell code in WordPress via the Markdown Quick Reference and Supported Source Codes! Woohoo!

This script is ready to be modified. It can easily be modified to be made into more of a tool, and also look at different Trend products (along with different versions). Reference my blog post for how I added/monitored the specific feeds. You will certainly need to modify the Send-MailMessage portion of the script in order for it to work properly.

Leave a Reply

Please log in using one of these methods to post your comment:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s