How to Export Messages from a Mail Queue on Exchange

April 16th, 2014 No comments

This post will describe how to export all messages from a mail queue on Exchange 2010, so the mails can be resubmitted on another server.

It is based on field notes, from a recent case, where we had to move a certain queue to another server.

It is possible to export one or all messages from one specific or all queues on an Exchange Server. This post describes how to do it for Exchange 2010, but the process is quite similar on Exchange 2013.

To do the export of messages, you can use the Export-Message cmdlet, which is part of Exchange. If you want to resubmit the exported mails (now .eml files), then put them into the replay directory on another Exchange server.

The default directory for the Replay Directory (on Exchange 2010) is:

C:\Program Files\Microsoft\Exchange Server\V14\TransportRoles\Replay


The script I used to Export all messages (mails) from the Exchange Queue is:

#Suspend all messages in the queue
get-queue ExchangeServer\663 | Get-Message | Suspend-Message
#Get all messages from the queue
$array = @(Get-Message -Queue "ExchangeServer\663" -ResultSize unlimited)
#Export all messages from the queu
$array | ForEach-Object {$i++;Export-Message $_.Identity | AssembleMessage -Path ("E:\Mailqueue\"+ $i +".eml")}


Find your Queue ID (Mine was ExchangeServer\663) using Get-Queue.


Reference documentation from TechNet:

Cumulative update package for Lync 2013: April 2014

April 11th, 2014 No comments


Microsoft has released the latest Cumulative Update for Lync 2013 (the client version).

This update provides the latest fixes for Lync 2013. This update version is 15.0.4605.1003.

Details about this update:

- Note: Download link in the KB articles above, redirects to March update.

Direct links to the April Update, can be found here:

Always find a complete list of updates for Lync at the TechCenter: Lync downloads and updates.

Categories: Lync Tags: ,

Script to validate your Office 365 DNS records

April 10th, 2014 No comments


Get-Office365DNSRecords.ps1 is a simple script for Office 365, that makes you quickly validate if your have configured your DNS records for use with Office 365 services.

It creates two report, one listed directly within the PowerShell prompt and a more detailed report which is saved to a file.

Example of the prompted report for e.g.

No autodiscover record found for
MX Records found for
SIP TLS Records found for
SIP Federation TLS Records found for
No SIP record found for
Lyncdiscover Record found for
No MSOID record found for

This script scans a CSV file for a list of domains and then scans each domain for DNS records that may indicate which Office 365 services is setup in DNS. So add your domains to the CSV file and you are ready to validate.

Download my script here:

Get-Office365DNSRecords.ps1 (45.6 KiB, 38 downloads)

Download is available on TechNet Gallery, download link above, will redirect you to TechNet Gallery. Please post comments regarding the script on this page, thx.

How to Remote PowerShell into Exchange Online Protection (Office 365)

March 31st, 2014 4 comments

Microsoft has announced the long-awaited (at least for me) possibility to use PowerShell to do Remote Connection to Exchange Online Protection.

I have previously blogged about doing Remote PowerShell session into Office 365 services, such as my post: How to Remote PowerShell into Exchange Online (Office 365).

Remote PowerShell is great administrative interface since it enables you to manage your Microsoft Exchange Online Protection (EOP) settings directly from PowerShell.

Examples of use could be:

  • Setup and configure Connectors
  • Configure Transport rules
  • Add Accepted domains

    How to Connect to Exchange Online Protection

You don’t need Office 365 MS Online PowerShell module for managing your Exchange Online Protection configuration with PowerShell. Just start a PowerShell session and type in following commands:

$Cred = Get-Credential


The above command prompts you, for your Office 365 (EOP) tenant admin credentials, it is important to enter as UPN format, such as e.g.

Next, we will create a new remote PowerShell session using the following cmdlet:

$s = New-PSSession -ConfigurationName Microsoft.Exchange -ConnectionUri -Credential $cred -Authentication Basic -AllowRedirection


Next, import the EOP cmdlets into your local PowerShell session, using the following command:

Import-PSSession $s

You are now connected to Exchange Online Protection (EOP) with you Office 365 (EOP) Tenant admin and can use Exchange Online Protection PowerShell cmdlets available.


For information about Exchange Online PowerShell cmdlets available see Reference to Available PowerShell Cmdlets in Exchange Online Protection on Technet.

To remove the PowerShell session again, run the following command:

Remove-PSSession $s

Remember to remove the session, when you are done.

Setup Wizard for Exchange Update Rollup ended prematurely

March 26th, 2014 No comments

The issue is well-known, but I never got around to share it myself and just recently saw it once again at a customer, who experienced the problem.

This blog post will cover how to install and the Exchange Rollup Update successfully without getting the “Ended prematurely” error.

The Setup Wizard for Update Rollup fails with the error “ended prematurely”. It has been the same issue for Update Rollups for both Exchange 2007 and Exchange 2010.

The installer fails with the information:

Setup Wizard for Update Rollup 5 for Exchange Server 2010 Service Pack 3 (KB2917508) ended prematurely because of an error. Your system has not been modified. To install this program at a later time, please run the installation again.

The screen dump below also shows what error look like:


The reason for the error and why the Update Rollup installer is “ended prematurely” is because the server has User Access Control (UAC) activated on the server. For good reason, it is not recommended to disable the UAC.

The error is also shown in the event log, as Event ID: 1024 and with error code 1603.



How to Install the Update Rollup

The recommended process for installing Update Rollups on the server, is using an elevated command prompt (Open a CMD with Run As Administrator) and make sure the Update Rollup is located on a local drive of the server and start the installer using:

SYNTAX example: msiexec /update <UPDATE .MSP FILE>

How to Start Setup Wizard:

msiexec /update Exchange2010-KB2917508-x64-en.msp

How to install the Update Rollup unattended (silent) add the following parameter (/quiet):

msiexec /update Exchange2010-KB2917508-x64-en.msp /quiet

Example as elevated command prompt starting the Update Rollup installer:


This will start the Setup Wizard and you can now walk your way through the installer and install the Update Rollup and when it has been installed, you should see the following:



Other reasons for failing

The above is the most obvious reason for why the Update Rollup fails with “ended prematurely”, but if you see error codes 1603 or 1635 in the event log, there could be other reasons. See the following KB articles on this, which might be able to help you in those scenarios:

Script: Change-MailboxType available for download

March 13th, 2014 1 comment


Change-MailboxType.ps1 is a simple script for Exchange 2010 and Exchange 2013, that makes it easier to change a regular Mailbox RecipientType to either a Room, Equipment or Shared Mailbox vice versa. The script display a small menu with options. No need to remember PowerShell parameters.

It is made so it is easy to use, for certain people in helpdesk so they quickly can change a regular Mailbox to a Room or Equipment or Shared Mailbox, with the option of going back to a regular Mailbox as well.

It also features the options to set the Booking Window In Days parameter for all Rooms and all Equipment Mailboxes.

Everything is packed into this easy to use script, with a menu showing the options to the helpdesk user:

When the script starts, it displays a menu, from where you can choose among 7 options:

1) Show Recipient Type of a Mailbox
2) Change Mailbox Type to a Room
3) Change Mailbox Type to Equipment
4) Change Mailbox Type to a Regular Mailbox
5) Change Mailbox to a Shared Mailbox
6) Change Booking Window In Days for all Rooms (set number of days)
7) Change Booking Window In Days for all Equipment (set number of days)

It has currently been tested on Exchange 2010.

Should work fine with Exchange 2013 and Office 365. For Office 365 you need to have done a remote session first, see a previous post: How to remote PowerShell into Office 365.

Download my script here:

Change-MailboxType (45.5 KiB, 86 downloads)

Download is available on TechNet Gallery, download link above, will redirect you to TechNet Gallery. Please post comments regarding the script on this page, thx.

Office 365 Summit – Copenhagen

March 7th, 2014 No comments


Microsoft just announced a series of Office 365 Summit events around the world and one of them is located in my neighborhood, Copenhagen, Denmark.

What is the Office 365 Summit:

The Office 365 Summits are a series of limited invitation 3 day workshops for Microsoft’s most valued customers and partners providing deep-dive readiness on all productivity workloads from Microsoft product experts.  

Office 365 Summit Denmark will feature content across Office 365, Developer, Exchange, Lync, Project, SharePoint, Visio/Visio Services, and Yammer tracks.  Exclusively for our partners, we will host a track (Drumbeat) to discuss how, what and why to sell and deploy Office 365.

During the summit, you will also have the opportunity to interact and learn from your industry peers and representatives from Microsoft at several evening events and scheduled networking time.

Read more about the event in Copenhagen:

Follow the news about Office 365 and events on the Ignite site:

Categories: Conference Tags: , ,

See you at MEC 2014

February 28th, 2014 1 comment


There is only one month (March 31 – April 2) till Microsoft Exchange Conference (MEC) in Austin, Texas.

I will be attending the conference and is looking forward to this great Exchange event and catching up with everyone in the community, both MCMs and MVPs.

Microsoft has announced over 100+ sessions at MEC and if you are interested, there should still be tickets available – go register at

If you are attending and want to catch up, let me know (catch me on @petsch) !

Find Me at MEC

Categories: Exchange Tags: ,