Category Archives: Exchange

Get detailed tracking information about specific email messages in Exchange


To receive detailed information from the tracking log use Get-MessageTrackingLog



Show activesync users with powershell


Powershell command to display the users who uses Active-sync to connect with smartphones to the exchange server.


to count the users, place the result in a variable an use count.


Move transport database and roles in Exchange 2013


When designing an Exchange 2013 environment I always recommend using an additional disk to store the Transport Database and accompanying transaction log files to a separate disk. When things with SMTP get out-of-control and the Queue database grows too much your boot- and system disk do not fill up.

The Exchange Transport Configuration is stored in a CONFIG file called EdgeTransport.exe.config which is stored in the C:\Program Files\Microsoft\Exchange Server\V15\Bin directory.

When you open this file with Notepad and scroll down you’ll find something like:

<add key=”QueueDatabasePath” value=”C:\Program Files\Microsoft\Exchange Server\V15\TransportRoles\data\Queue” />

<add key=”QueueDatabaseLoggingPath” value=”C:\Program Files\Microsoft\Exchange Server\V15\TransportRoles\data\Queue” />

<add key=”IPFilterDatabasePath” value=”C:\Program Files\Microsoft\Exchange Server\V15\TransportRoles\data\IpFilter” />

<add key=”IPFilterDatabaseLoggingPath” value=”C:\Program Files\Microsoft\Exchange Server\V15\TransportRoles\data\IpFilter” />

<add key=”TemporaryStoragePath” value=”C:\Program Files\Microsoft\Exchange Server\V15\TransportRoles\data\Temp” />

These are the location where you will find the Transport Queue database and the IpFilter database files and their corresponding transaction log files.

You can changes these directories to for example D:\TransportRoles\data\… and after you restart the Transport service the new location is used. The problem is that the ‘old’ Queue database is not moved. When the Transport service is restarted a new Queue database is created in the new location. If you have any (SMTP) mail in the old queue this gets lost.

Microsoft has created a scripts called Move-TransportDatabase.ps1 (located in the $ExScripts directory) which changes the location, moves the Queue Database and restarts the Transport service automatically. The Move-TransportDatabase.ps1 script takes the following parameters:

  • queueDatabasePath
  • queueDatabaseLoggingPath
  • iPFilterDatabasePath
  • iPFilterDatabaseLoggingPath
  • temporaryStoragePath

Resulting in a command like this:


Note: take care about the ‘ character in the different values!

When you run this command you’ll see some requirement information, creation of the new directories, moving the databases and restarting the Transport service

Grand access to a user mailbox


To grand access to a user mailbox use the you have to Add Mailbox permissions to the mailbox.

In this example the user avanboerum gets full access to the mailbox of johndoe.

Remove old logfiles from Exchange servers


You can use Powershell to remove old logfiles from exchange servers. Those logfiles are located on the Client Access Servers (CAS servers) in the inetpub folders.

To remove the files older then 60 days use this script.

Fill in your own CAS servers on the variable $servers line. You can use as many as you want to.


Remove specific email from one or all mailboxes


If you need to remove specific email from one or all mailboxes on an exchange server you don’t need to attach all of those e-mail boxes in your Outlook. You can use powershell to search for those email, move them to an other mailbox (if you want) and delete the email from the mailboxes.

First, you need to create a powershell session to your exchange server in order to get access to the right commandlets.

Next, give your account the necessary permissions to access the Mailboxes on the exchange mailbox servers.

Read more »

Archive-User function – Clean up an user from AD and Exchange


(updated version as a function. Some error handling will follow later)

Powershell Function for cleaning up an AD user and exchange account. This can be used for example when a user leaves the company.

The information, files and mail from the user is placed in an archive folder on the network. After this has been done the user is cleaned from the network.

use as: .Archive-MWUser.ps1 -Mwusername  avanboerum

Change Delivery method for Exchange


When you use your providers SMTP server for routing your exchange e-mail you can run into problems if these servers are in error. You can send the e-mail directly to the recipients SMTP server instead of sending via the SMTP server of your provider.
The following scripts adjust these settings and restart the mail transport on my two mailbox servers.

Use the SMTP server of your internet provider:

Use the MX records of the recipients:

Export to PST


Use this script to export an users e-mail box from an exchange server to a .pst file withPowershell

Find status on the running mailbox request



Get-mailbox size in CSV


Use this script to display the size of users mailboxes on a exchange server and exports this information to a CSV file.

Exchange queue viewer


View the contents of exchange e-mail queue.

Connect to Powershell in Exchange


To start a new connection to an Exchange server and use its commandlets.