PowerShell: Script to move items from one folder to another in a user’s mailbox

Note: A completely rewritten and enhanced version of this script can be found here. Manipulation of mailbox items is not something that is really available using Exchange cmdlets – understandably, as Exchange PowerShell is for administration of the Exchange environment rather than manipulation of mailboxes themselves.  Of course, PowerShell itself offers all the features needed…

60

PowerShell: Merge mailbox folders

Note: I have removed the script download from this page, as maintaining it in two places seems unnecessary.  The new home for this script and any updates is here: https://code.msdn.microsoft.com/office/PowerShell-Merge-mailbox-e769c529.   A couple of years ago I wrote a script to move items from one folder to another in a user’s mailbox.  This seems to…


PowerShell: Create folders in users’ mailboxes

Here is a PowerShell EWS script that will create folders (one or more) in users’ mailboxes.  To run it against a single mailbox, syntax is: .\Create-Folders.ps1 user1.ex2k7@hybrid.local “Folder 1;Folder 2” By default, folders are created under the inbox.  For multiple folders (as above), separate the folder names with a semicolon.  You can specify the parent…

42

PowerShell: Search mailbox for items of a particular message class (ItemClass)

The Search-Mailbox cmdlet can be used to perform various searches within a mailbox, and while it serves many needs, there are some searches that it can’t do.  I wrote a PowerShell script to demonstrate how to perform a search of a mailbox (or mailboxes) using EWS, in this case looking for items of a particular…

32

PowerShell: Remove duplicate calendar appointments

We regularly get requests for an automated way of deleting duplicate appointments from calendars (most often caused by migration issues or mistaken mailbox imports, but there are lots of reasons that you could end up with duplicates).  So, here is a script that checks for and deletes duplicates.  As usual, it uses EWS to connect…


PowerShell: Script to recover all deleted items in a mailbox

UPDATE 14/9/2018: Script has now moved to https://gallery.technet.microsoft.com/exchange/PowerShell-Recover-items-89f9f92e, and supports recovery to original item location.  I’ve removed the script from this page, as it is outdated. We had a request recently for a sample PowerShell script that shows how to recover deleted items from and Exchange 2010 mailbox.  While not possible (as far as I am…

26

PowerShell: Search for appointments

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…


Exchange: Automating a Welcome Email to New Users

Since Exchange 2010, it has been possible to use Scripting Agents to perform additional checks/processing when certain cmdlets are run.  This feature can be used to automatically send an email to welcome new users.  An overview of scripting agents and how they work can be found on Technet. To send an email when a new…


MAPI Utility to add Ldap Address Books to existing Outlook profiles

Current version: 1.0.0.4   I’ve had quite a few requests recently for a tool that can configure Ldap (Internet) Address Books in existing Outlook profiles. Since I don’t know of any tool to do this except for the good ole PRF import, I’ve decided to write some code for posterity. Unlike the PRF import, this…

12

PowerShell: Update folders (delete/purge, or add/delete properties)

Please note: the script has now been moved to https://code.msdn.microsoft.com/PowerShell-Update-mailbox-1e17866d. This script allows you to update folders by adding or removing properties.  You can also use the script to purge or delete the folders. To delete properties from a folder: .\Update-Folders.ps1 -Mailbox 1@e14.local -FolderPath “\Folder 1” -ProcessSubFolders -DeleteFolderProperties @(“0x36160102”, “0x36DA0102”) In the above example, MAPI properties…