IT Praktyk Blog

Make Exchange Hybrid Admin Life Easier - part 2

Posted June 26, 2016; Last update June 26, 2016

Introduction

In the part 1 of that series I wrote about network requirement what need to be done on a network level to connect to Office 365 and parsing O365IPAddresses.xml what is published here.

Today I would like share with you how the changes to that file are announced and how data about these changes can be parsed to PowerShell object to make EXchange Hybrid Admi Life Easier :-)

Microsoft publishes information about planned changes for network part of Office 365 as the RSS channel published at https://support.office.com/en-us/o365ip/rss.

The example of a RSS feed, opened in Firefox you see below.

More about RSS format you can read in Wikipedia.

Since February, 8th 2016 published information is more structured so can be parsed automatically - in allmost all cases. For that you can use PowerShell function ConvertFrom-O365AddressesRSS.ps1 what I wrote and published to TechNet Gallery today.

Action

To use function you need to:

Results

Result 1

If you run the function in PowerShell console without any parameter


ConvertFrom-O365AddressesRSS

as the result the custom PowerShell object will is returned - like on the screenshot below.

Because custom PowerShell object is returned - as should be for any decent PowerShell function - you can pipe it to other PowerShell cmdlet e.g. Export-CSV. But for exporting to CSV you need to remember that some fields can contains commas so you should use other char as delimiter e.g. a semicolon. The semicolons are removed from parsed object - due that in structure the RSS feeds are used to separate subfields - so can be considered as ‘safety’ to be delimiters.

In the output object you can see the property ‘Subchanges’, that property contains array of custom PowerShell objects as shown in the result 2.

Result 2

ConvertFrom-O365AddressesRSS -Path .\O365IPAddressesChanges-20160626-211908.xml | Where-Object -FilterScript { $_.guid -eq '03bfd502-9fe7-4107-afa2-04cfc402afd6' } | Select-Object -Property PublicationDate,Guid,QuickDescription,Title -ExpandProperty SubChanges

Result 3

Of course, even after adding some workarounds in a code not all RSS items can be parsed successfully.

Summary

Full syntax for the ConvertFrom-O365AddressesRSS function is like shown below.


ConvertFrom-O365AddressesRSS [-Path <string>] [-Start <datetime>] [-End <datetime>] [-RemoveFileAfterParsing] [<CommonParameters>]

ConvertFrom-O365AddressesRSS [-DownloadRSSOnly] [-PassThru] [<CommonParameters>]

As you can see the function has two parameters sets - the first can be used to parse, the second to download RSS content. In the second scenario ‘-PassThru’ parameter returns .Net object [System.IO.FileInfo] as a reference to downloaded and saved to disk a RSS channel.

Remarks