Skip to main content

Powershell form for Reporting on all Appointments in all mailboxes on a Server using WebDAV

This is another script that's similar to the last few that I've posted in that its designed to query all the mailboxes on a given server and then report the information it finds. The way this script differs is that firstly its a powershell script and secondly it creates a little Winform gui to allow you to interact with the results of the query so its no longer just a static report. The layout it reports back in is two Listviews the first list view shows a summary of the number of appointments the WebDAV query finds for each mailbox and the second is activated when you click a row in the first list view which then shows a list of the appointments in the calendar of the mailbox selected. To make this a little more useful I've added a bunch of filtering options across the top so you can take the original data captured in the appointment query and filter it in a few different ways. Eg you can filter it by the last modified date so you could answer a question such as

Show me all the appointments that where modified after a certain date Or
Show me all the appointments that where modified before a certain date

The two other filtering options are for Free/Busy so you can show all the appointments that are set to free in the time period or all the appointments that aren't set to free. the last filter option is for the Time Zone Mapi property that Matt Stehle blogged about the other day this should show you all the appointments that the rebasing tool has been run on and any that it hasn't. You can combine multiple filters so you could show the number of appointments that where modified after a certain date by the rebasing tool etc.

The Script uses WebDAV via the Admin virtual root directory to access the user calendars this gets around the need for the user running the script to have rights in the users mailbox and should be able to be run successfully using just delegated Exchange Admin rights. To work out the correct path to use for the Admin virtual root the script includes a LDAP query that gets the default SMTP FQDN from the default recipient policy.
By default the script isn’t using SSL which may mean you need to adjust the following line if you are using SSL on the ExAdmin Directory
Eg change line 162
$arMbRoot = "http://" + $snServerNameDrop.SelectedItem.ToString() + "/exadmin/admin/" + $dfAddress + "/mbx/"

to

$arMbRoot = "https://" + $snServerNameDrop.SelectedItem.ToString() + "/exadmin/admin/" + $dfAddress + "/mbx/"

The script works by querying appointments and then filling a datatable the filtering options work by filtering the data in the datatable using Table selects built by examining the state of different controls and repopulating that data in the listviews I've taken the complete automation approach with this script so there are no command line parameters or servername variables to fill out. When the script runs it will populate the servername list box with the name of all the Exchange servers it finds by querying the configuration partition of the domain its being run in. When you use the script itself you only need to hit the get-appointment button once. After you hit the button in the background the script will attempt to get the appointments for the server you select this can be a lengthy operation to give some progress the script writes back to the console windows as it processes each mailbox. So you may want to push the form to one side and what the status of the powershell console window as it processes each mailbox. When you want to re-filter the data using the filtering options make sure you hit the filter button to filter the data and not the get-appointment buttons. The filter button will re-filter the data in a matter of seconds while the get-appointments but will re-query all the appointments which will take a considerable amount of time. If you want to query other times outside of the DST affected ones you can with this script using the datetime pickers for start and end time..
I've put a downloadable copy of the script here the script itself blew out to over 500 lines so its a little two large to post.

Popular posts from this blog

Testing and Sending email via SMTP using Opportunistic TLS and oAuth in Office365 with PowerShell

As well as EWS and Remote PowerShell (RPS) other mail protocols POP3, IMAP and SMTP have had OAuth authentication enabled in Exchange Online (Official announcement here ). A while ago I created  this script that used Opportunistic TLS to perform a Telnet style test against a SMTP server using SMTP AUTH. Now that oAuth authentication has been enabled in office365 I've updated this script to be able to use oAuth instead of SMTP Auth to test against Office365. I've also included a function to actually send a Message. Token Acquisition  To Send a Mail using oAuth you first need to get an Access token from Azure AD there are plenty of ways of doing this in PowerShell. You could use a library like MSAL or ADAL (just google your favoured method) or use a library less approach which I've included with this script . Whatever way you do this you need to make sure that your application registration  https://docs.microsoft.com/en-us/azure/active-directory/develop/quickstart-register-

The MailboxConcurrency limit and using Batching in the Microsoft Graph API

If your getting an error such as Application is over its MailboxConcurrency limit while using the Microsoft Graph API this post may help you understand why. Background   The Mailbox  concurrency limit when your using the Graph API is 4 as per https://docs.microsoft.com/en-us/graph/throttling#outlook-service-limits . This is evaluated for each app ID and mailbox combination so this means you can have different apps running under the same credentials and the poor behavior of one won't cause the other to be throttled. If you compared that to EWS you could have up to 27 concurrent connections but they are shared across all apps on a first come first served basis. Batching Batching in the Graph API is a way of combining multiple requests into a single HTTP request. Batching in the Exchange Mail API's EWS and MAPI has been around for a long time and its common, for email Apps to process large numbers of smaller items for a variety of reasons.  Batching in the Graph is limited to a m

How to test SMTP using Opportunistic TLS with Powershell and grab the public certificate a SMTP server is using

Most email services these day employ Opportunistic TLS when trying to send Messages which means that wherever possible the Messages will be encrypted rather then the plain text legacy of SMTP.  This method was defined in RFC 3207 "SMTP Service Extension for Secure SMTP over Transport Layer Security" and  there's a quite a good explanation of Opportunistic TLS on Wikipedia  https://en.wikipedia.org/wiki/Opportunistic_TLS .  This is used for both Server to Server (eg MTA to MTA) and Client to server (Eg a Message client like Outlook which acts as a MSA) the later being generally Authenticated. Basically it allows you to have a normal plain text SMTP conversation that is then upgraded to TLS using the STARTTLS verb. Not all servers will support this verb so if its not supported then a message is just sent as Plain text. TLS relies on PKI certificates and the administrative issue s that come around certificate management like expired certificates which is why I wrote th
All sample scripts and source code is provided by for illustrative purposes only. All examples are untested in different environments and therefore, I cannot guarantee or imply reliability, serviceability, or function of these programs.

All code contained herein is provided to you "AS IS" without any warranties of any kind. The implied warranties of non-infringement, merchantability and fitness for a particular purpose are expressly disclaimed.