PowerShell: Checking the Syntax of an Exchange Mailbox Export Content Filter

A bit of a niche function this one.  When you perform a mailbox export in Exchange using the New-MailboxExportRequest cmdlet you can specify the ContentFilter parameter.  This allows you to pass an OPATH filter to only export SOME of the content from a mailbox.

One of the examples on the page above is;

New-MailboxExportRequest -Mailbox Tony -ContentFilter {(body -like “*company*”) -and (body -like “*profit*”) -and (Received -lt “01/01/2012”)}

So what if you need to check the syntax of a ContentFilter? Continue reading “PowerShell: Checking the Syntax of an Exchange Mailbox Export Content Filter”

PowerShell: Display A Menu And Get a Valid Choice

While it’s normally best practice to not display anything on the host and to batch as much as possible with PowerShell; sometimes you need a UI.  Here’s a pair of functions to display a menu on the screen, automatically number the possible responses and only return when a valid choice is made. Continue reading “PowerShell: Display A Menu And Get a Valid Choice”

PowerShell: Function to see if a Set of Properties Are on a Custom Object

I’ve been using scripts that pass loads of custom objects back and forth as function parameters.  In some cases these objects are built dynamically so they could have different properties on them.

It’s useful then to check if a particular set of parameters are on an object.

Hence;  this function!  (After the line!) Continue reading “PowerShell: Function to see if a Set of Properties Are on a Custom Object”