Removing Messages by Message Class (Updated)

powershellRecently, I was asked if it is possible to remove stub items. The reason was they were going to transition to a newer version of Exchange and they won’t be using the archiving solution in the new environment. When required, vendor tooling would be used to search through the (old) archives.

In such cases it makes sense to remove the stubs from the mailbox, which are shortcut messages that points to a copy of the original message in the archive solution. The new environment won’t contain the required Outlook plugins or extensions to retrieve the original message from the archive using the stub, so the stub will mostly lead to a partial or empty message.

To identify stubs, one can filter on an attribute of each item, MessageClass. This attribute defines which kind of item it is (and in fact, determines what form Outlook should use in order to present or process the information). Examples of MessageClass definitions are IPM.Note (regular e-mail messages), IPM.Note.EnterpriseVault.Shortcut (message archived by Enterprise Vault) or IPM.ixos-archive (message archived by Opentext/IXOS LiveLink E-Mail Archive).

To identify stubs from Outlook, add the Message Class field to your Outlook view, e.g.:

StubsOutlook

When you want to remove the stubs using Outlook, you can utilize the Advanced Find function of Outlook, but that is a very labor intensive, tedious and non-centralized per-mailbox procedure:

SearchFromOutlook

Now I wouldn’t have started this article if the same thing wasn’t possible with a little bit of scripting against Exchange Web Services and so the script Remove-MessagesClassItems.ps1 was born. Using this script requires Exchange 2007 or later and Exchange Web Services Managed API 1.2 (or later) which you can download here or you can copy the Microsoft.Exchange.WebServices.DLL locally and adjust the DLL path mentioned in the script when necessary. The script has been developed and tested against Exchange 2007, meaning it’s a PowerShell 1.0 script which should be compatible with later versions of PowerShell or Exchange.

Also take notice that since you’ll be processing user mailboxes, you’ll need to have full mailbox access or impersonation permissions; the latter is preferred. For details on how to configure impersonation for Exchange 2010 using RBAC, see this article or check here for details on how to configure impersonation for Exchange 2007.

The script Remove-MessagesClassItems.ps1 uses the following syntax:

Remove-MessageClassItems.ps1 [-Mailbox] <String> [-MessageClass] <String> [-Server <String>] [-Impersonation] [-DeleteMode <String>] [-WhatIf] [-Confirm] [<CommonParameters>]

A quick walk-through on the parameters and switches:

  • Mailbox is the name of the mailbox of which to fix the folder structure;
  • MessageClass specifies the Message Class to remove, for example IPM.Note.EnterpriseVault.Shortcut (EnterpriseVault);
  • Server is the name of the Client Access Server to access for Exchange Web Services. When omitted, the script will attempt to use Autodiscover;
  • When the Impersonation switch is specified, impersonation will be used for mailbox access, otherwise the current user context will be used;
  • DeleteMode specifies how to remove messages. Possible values are HardDelete (permanently deleted), SoftDelete (use dumpster, default) or MoveToDeletedItems (move to Deleted Items folder).

So for example, suppose you want to remove  IPM.Note.EnterpriseVault.Shortcut items from the mailbox of user1, moving the items to the DeletedItems by Impersonation. In such case, you could use the following cmdlet:

Remove-MessageClassItems.ps1 -Mailbox user1 -MessageClass IPM.Note.EnterpriseVault.Shortcut -DeleteMode MoveToDeletedItems -Impersonation –Verbose 

SampleOutput

Note: Remove-MessageClassItems.ps1 will only process IPF.Note class folders (i.e. containing mail items), so you’ll only see those being processed.

In case you want to process multiple mailboxes, you can use a CSV file which needs to contain the Mailbox field. An example of how the CSV could look:

Mailbox
francis
philip

The cmdlet could then be something like:

Import-CSV users.csv1 | Remove-MessageClassItems.ps1 -MessageClass IPM.Note.EnterpriseVault.Shortcut -DeleteMode HardDelete -Impersonation

You’re feedback is welcomed through the comments; if you got scripting suggestions, please use the contact form.

You can download the script from the Technet Gallery here.

Revision History
1.01: Fixed example (IPM.ixos-archive instead of IBM.ixos-archive) and removed EMS requirement

The UC Architects Podcast Ep21

iTunes-Podcast-logo[1]The 21th episode of The UC Architects podcast is now online. The UC Architects is a bi-weekly community podcast by people with a passion for Unified Communications; our main focus is on Exchange, Lync or related subjects.

This episode is hosted by Pat Richard who’s joined by Serkan Varoglu, Johan Veldhuis, Mahmoud Magdy and Dave Stork.

Amongst the topics discussed in this episode are:

  • Exchange storage design
  • Exchange 2013 implementation
  • The mysterious Exchange App
  • Script converting mail-user to mailbox-user
  • Evoko Room Manager
  • Lync and Yahoo federation
  • Lync Mac 2011 update
  • Lync Conference contents
  • Script to find available numbers in Lync
  • Lync LPE update
  • Lync desktop sharing issue
  • TechEd NA/Europe

More information on the podcast including references and a link to download the podcast directly here or you can subscribe to the podcasts using iTunes, Zune or use the RSS feed.

The UC Architects Windows Phone App

Most of you listen to or at least are aware of our The UC Architects podcast. If not, The UC Architects is the world’s most popular community podcast on Exchange and Lync made by people with a passion for Microsoft Unified Communications.

CaptureNow, as of today and thanks to fellow Johan Veldhuis, you can keep track of new podcasts when travelling, check our Tweets or even download and listen to podcasts using the UC Architects Windows Phone App. The app is available for Windows Phone 7 and 8. More information on the app itself can be found on our The UC Architects website.

You can download the app here.

Exchange 2013 KB articles RSS feed

rss[1]Like most people I still use RSS feeds to keep track of news and updates from various sources. But not everyone is aware you can keep track of new or updated Microsoft’s knowledgebase articles using RSS feeds, sometimes categorized per product. I already blogged about the availability these feeds about 2,5 years ago.

Now with all the releases since then, it’s time to update this information with current products, especially with the feed for Exchange 2013 related articles becoming available recently:

For a complete list of the knowledgebase articles RSS feeds check here.

Exchange 2013 Server Role Requirements Calculator v5.1

Ex2013 LogoIt’s been long wait since the release of Exchange 2013, but today the Exchange Team finally released the first version of the Exchange 2013 Server Role Requirements Calculator. This initial release is numbered version 5.1.

Some of the highlights over the Exchange 2010 calculator, mostly due to changes in the architecture, are:

  • The calculator includes transport sizing (hence the name, I guess);
  • Accommodating for Client Access Server role with sizing for multi-role server deployments;
  • Support for multiple databases / JBOD volumes;
  • Configurable witness server location (primary, secondary or tertiary data center);
  • Configurable server names and database prefixes for generated scripts;
  • Generated scripts include script for DAG creation;
  • Support for single HA, Act/Pas and Act/Act distribution models.

You can download the calculator here. For more information, please consult the documentation here.

Exchange 2013 Unattended Installation Script v1.1

Ex2013 LogoComing back from a nice vacation to the beautiful Brittany in France, I thought it was time to collect and process feedback and suggestions on several scripts, starting with the Exchange 2013 unattended installation script for Windows Server 2012.

Changes in version 1.1 of the script:

  • When the script was used to also prepare Active Directory, RSAT-ADDS-Tools was uninstalled as part of the cleanup. Per request, I’ve removed the uninstallation of that feature;
  • The script now detects pending reboots after installing the required features. When ran in AutoPilot mode, the script will reboot and restart the phase (preparing Active Directory, which can’t be run with pending reboots because Exchange’s Setup won’t like it). When not running in AutoPilot mode, you need to start the script manually. You can omit providing installation parameters as they are saved, even a pending is detected;
  • The Windows feature Server-Media-Foundation will be installed explicitly as it is an UCMA 4.0 requirement;
  • The credentials provided for AutoPilot mode will be validated;
  • The OS version check is changed to a string which should enable installation on non-US Operating Systems.

You can download the updated version of the script via the original Exchange 2013 Unattended Installation Script page or directly from the Technet Gallery. Enjoy!

The UC Architects Podcast Ep20

iTunes-Podcast-logo[1]The 20th episode of The UC Architects podcast is now online.

This episode is hosted by Steve Goodman who’s joined by Johan Veldhuis, Michael Van Horenbeeck, Paul Cunningham, John Cook, Justin Morris, Andrew J. Price and yours truly.

Amongst the topics discussed in this episode are:

  • Exchange 2013 CU1
  • Lync Updates
  • Outlook Web App
  • “Problems in UC”
  • Scripts
  • Events

More information on the podcast including references and a link to download the podcast directly here or you can subscribe to the podcasts using iTunes, Zune or use the RSS feed.

About
The UC Architects is a bi-weekly community podcast by people with a passion for Unified Communications; our main focus is on Exchange, Lync or related subjects.

Lync Conference 2013 Recordings

Microsoft-Lync-2013-Logo_19218C3C[1]A quick heads-up for everyone working with or interested in Lync Server 2013.

In February, the inaugural Lync Conference was held in San Diego. The conference not only had excellent sessions on Lync and UC related topics but also featured our The UC Architects monster prize draw.

Now, if you were unable to attend – like me – you missed out on but could buy the content for $199 as of March.Fortunately, Microsoft has decided to make presentations and session videos available for free.

You can download the slidedecks and videos here.

Exchange 2013 CU1 Help File

Ex2013 LogoA quick post as the Exchange 2013 Cumulative Update 1 Help file (.CHM) file for offline usage has been released on the Microsoft Download Center.

The offline help files files are convenient if you’re on the road or in a location (yes, that happens sometimes) without internet connection.

You can download the Exchange 2013 Cumulative Update 1 .CHM Help file dated April 4th, 2013 for On-Premise and Hybrid deployments here.

Exchange 2013 Cumulative Update 1 (Updated)

Ex2013 LogoToday the long-awaited Cumulative Update 1 for Exchange Server 2013 was released by the Exchange Team (KB2816900). This update raises Exchange 2013 version number to 15.0.620.29.

As mentioned in an earlier post, this is the Exchange 2013 product level required for co-existence with previous versions of Exchange, being Exchange Server 2010 SP3 or Exchange Server 2007 SP3 Rollup 10.

The Exchange Team provided a description of the major changes in CU1 in the CU1 announcement here; Here are some of the major changes in CU1:

  • Includes Address Book Policy Routing Agent (info);
  • Allows group memberships to be managed by groups (again, as it was possible in Exchange 2007 but not in Exchange 2010);
  • Access to Public Folders you have added as favorites via your favorites menu either in Outlook or Outlook Web App (still no regular Public Folder tree access though);
  • EAC has been enhanced and now includes Unified Messaging management and migration options;
  • Many probes, monitors, and responders have been updated and improved over the RTM release;
  • Get-HealthReport cmdlet has been streamlined and its performance has been optimized;
  • Supports the Exchange Server 2013 Management Pack for SCOM 2007 R2 and SCOM 2012 (due at a later date);
  • High Availability changes (reported on by Scott Schnoll here).

Note that CU1 includes schema changes. Like Service Packs for earlier versions of Exchange, the Cumulative Update is indeed cumulative (hence the size of 1.3 GB) and you can install it directly, i.e. no need to install RTM first. Also, once installed you can’t uninstall CU1 or any of the installed roles. The order of upgrading servers doesn’t matter, unlike with earlier Exchange versions.

You can download Exchange 2013 Cumulative Update 1 here.

Update 3rd April, 2013: Meanwhile, the TechNet documentation has been updated; relevant sections for upgrading are: