PowerShell: Search for appointments No ratings yet.

0

You can use the Exchange cmdlet Search-Mailbox for a wide variety of searches, but it does have some limitations.  Attached here is a PowerShell script that uses EWS to search appointments, and as the script uses both server and client side search it can be used to performs searches that aren’t possible with Search-Mailbox (and it can also be used on your own mailbox without requiring to connect to an Exchange PowerShell session).  This script will work for both on-premise installations of Exchange (2010 or higher, it will probably work with 2007 but may need minor changes, and I haven’t tested there!) as well as Office 365.

The download link for this script has been removed, as it has now been moved to https://code.msdn.microsoft.com/exchange/PowerShellEWS-Search-e0f9c169

 

Parameters

 

 -Mailbox The mailbox to be processed (if missing, current user’s mailbox is assumed, though this will only work in a domain environment).
 -FolderPath  Folder to search – if omitted, the mailbox calendar folder is assumed.
 -PublicFolders  If this switch is present, folder path is required and the path points to a public folder.
 -Subject  Subject of the appointment(s) being searched.  A -like comparison is used, so wildcards should work.
 -StartsAfter  Start date for the appointment(s) must be after this date.
 -StartsBefore  Start date for the appointment(s) must be before this date.
 -EndsBefore  End date of the appointment(s) must be before this date.
 -EndsAfter  End date of the appointment(s) must be after this date.
 -CreatedBefore  Only appointments created before the given date will be returned.
 -CreatedAfter  Only appointments created after the given date will be returned.
 -LastOccurrenceBefore  Only recurring appointments with a last occurrence date before the given date will be returned.
 -LastOccurrenceAfter  Only recurring appointments with a last occurrence date after the given date will be returned.
 -IsRecurring  If this switch is present, only recurring appointments are returned (note that this is implied if LastOccurrenceBefore or LastOccurrenceAfter are set).
 -Delete  If specified, any matched appointments will be deleted. Use with care!
 -Credentials  Credentials used to authenticate with EWS.
 -Username  Username used to authenticate with EWS.
 -Password  Password used to authenticate with EWS.
 -Domain  Domain used to authenticate with EWS.
 -Impersonate  Whether we are using impersonation to access the mailbox.
 -EwsUrl  EWS Url (if omitted, then autodiscover is used).
 -EwsManagedApiPath  Path to managed API (if omitted, a search of standard paths is performed).
 -IgnoreSSLCertificate  Whether to ignore any SSL errors (e.g. invalid certificate) – use with care.
 -AllowInsecureRedirection  Whether to allow insecure redirects when performing autodiscover.
 -LogFile  Log file – activity is logged to this file if specified.
 -ExportCSV  File to which matching appointment data will be exported

 

Examples

 

.\Search-Appointments.ps1 -LastOccurrenceAfter 30/Dec/2016 -ExportCSV c:\temp\apts.csv
Will find all appointments in the current user’s calendar with a last occurrence date after 30th December 2016 (note that this will only match recurring appointments)

.\Search-Appointments.ps1 -Mailbox user@office365.com -Credentials (Get-Credential) -LastOccurrenceAfter 30/Dec/2016 -ExportCSV c:\temp\apts.csv
Performs the same search as the first example, but against an Office 365 mailbox and will prompt for credentials.

.\Search-Appointments.ps1 -LastOccurrenceAfter 30/Dec/2016 -ExportCSV c:\temp\apts.csv -Delete
Performs the same search as the first example, but deletes any matching appointments found (the details of those appointments will also be exported to the CSV).

0

Please rate this

2 thoughts on “PowerShell: Search for appointments

  1. Hello,

    i want to thank you for this amazing script.
    And i want to ask is it possible for this to modified so it can be possible to search again in entire org and meetings from particular mbx ?
    the goal it to search of all meetings (hr inbox) send across the organisation.

    Thank you very much in advance.

    0

Leave a Reply

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