Reactivate a broken IMAP service on Microsoft Exchange 2013/2016

And one day, suddenly, IMAP service stopped working properly on my Exchange 2013 mail server.

Usually by telneting to imap port, exchange server returns a banner.

0

When the IMAP service is broken, the telnet screen is blank and the connection aborts. The initial idea to restart the IMAP services on the exchange does not fix the problem. (In this case all the exchange roles reside on the same server)

4

Run the following command on a powershell window

Get-HealthReport <servername>  | where { $_.state -eq “Offline”}

It will return an offline IMAP.Proxy healthstate.

1

Usually this is a Microsoft bug, since it appears after installing a Cumulative Update on the Exchange Server. By setting online the IMAPProxy, the IMAP service comes into life. Run the following command:

Set-ServerComponentState -Identity <servername> -Component IMAPProxy -State Active -Requester HealthAPI

2

more at Microsoft

Reporting Mailbox Sizes on Microsoft Exchange 2010

The useful feature of displaying mailbox sizes is missing from Exchange Management Console (EMC) on MS Exchange 2010, so you cannot quickly estimate mailbox sizes on your Exchange Databases. You need to dive into powershell cmdlets to get this information. I agree that powershell cmdlets are powerful, there is no question about it. But gui is beautiful, Microsoft should have included a gui interface for this!

First of all, I am using Powershell version 2.0, since we host Exchange Services on Windows 2008 R2 platform. Before retrieving exchange information, let’s have a look on some useful utility powershell cmdlets that are extremely useful for pipelining multiple cmdlets.

  • Format-Table (alias ft): formats the output as a table
  • Get-Member (alias gm): get information about the objects that the cmdlets return (methods and properties)
  • Sort-Object (alias sort): Sort objects by property values
  • Select-Object (alias select): Selects objects or object properties
  • Import-CSV (alias ipcsv): Creates table-like custom objects from the items in a CSV file
  • Export-CSV (alias epcsv): Converts objects into a series of comma-separated (CSV) strings and saves the strings in a CSV file

We will use these cmdlets in our examples.

Get-MailboxStatistics is a basic building block to gather information about Exchange mailboxes. It returns several  information per mailbox, per database or per server. Run the following cmdlets using a different scope.

Get-MailboxStatistics -Identity <mailbox name>
Get-MailboxStatistics -Database <database name>
Get-MailboxStatistics -Server <server name>

Now run the following command to check out that mailbox objects that you can retrieve for each mailbox.

Get-MailboxStatistics -Identity <mailbox name> | Get-Member

or using the alias

Get-MailboxStatistics -Identity <mailbox name> | gm

MailboxStatistics objects

MailboxStatistics objects

There is tons of information that you can retrieve here, but usually you don’t need all these. Filter out the display items by using the Format-Table cmdlet

Get-MailboxStatistics -Identity <mailbox name> | Format-Table DisplayName, TotalItemSize

or again using the alias

Get-MailboxStatistics -Identity <mailbox name> | ft DisplayName, TotalItemSize

MailboxStatistics Filtering

MailboxStatistics Filtering

When you run Get-MailboxStatistics -database <database name> or a similar cmdlet, the information will not display clearly, you better sort the data by, let’s say, the mailbox size by running

Get-MailboxStatistics -database <database name> | sort TotalItemSize -Descending | ft DisplayName, TotalItemSize

or

Get-MailboxStatistics -database <database name> | sort TotalItemSize -Descending | select DisplayName, TotalItemSize –First 5

to display the top 5 mailboxes by TotalItemSize

or

Get-MailboxStatistics -database <database name> | sort TotalItemSize -Descending | select DisplayName, TotalItemSize | epcsv <path & export filename>

to export the data to a csv file.

Displaying mailbox sizes in bytes is not user friendly, so run the following cmdlet to display sizes in MB.

Get-MailboxStatistics -server <server name> | sort TotalItemSize -Descending | select DisplayName, StorageLimitStatus, @{label="Total Size (MB)";expression={$_.TotalItemSize.Value.ToMB()}}, @{label="Deleted Item Size (MB)";expression={$_.TotalDeletedItemSize.Value.ToMB()}}

Checkout the available methods of TotalItemSize by running the following

(Get-MailboxStatistics <mailbox name>).TotalItemSize.value | gm

TotalItemSize Methods

TotalItemSize Methods

If you need to make a mailbox size report for specific users, you can create a new file called c:\input.csv. Type in Mailbox on the first line and insert the specific mailbox names in every separate line. Save it and run the following command.

ipcsv "c:\input.csv" | ForEach-Object -Process {Get-Mailbox $_.Mailbox | select DisplayName,@{n="Size(MB)";e = {$MBXstat = Get-MailboxStatistics $_.name; $MBXstat.totalItemsize.value.toMB()}},@{n="DeletedSize(MB)";e = {$MBXstat = Get-MailboxStatistics $_.name; $MBXstat.totalDeletedItemsize.value.toMB()}},@{n="Items"; e = {$MBXstat = Get-MailboxStatistics $_.name ; $MBXstat.itemcount}},@{n="DeleteItems"; e = {$MBXstat = Get-MailboxStatistics $_.name ; $MBXstat.deleteditemcount}}} | epcsv "c:\output.csv"

(the example was taken from Memphis Technical Network site)

Finally, Get-MailboxFolderStatistics cmdlet breaks down the mailbox information per subfolder. Display the available objects by running

Get-MailboxFolderStatistics <mailbox name> | gm

MailboxFolderStatistics Objects

MailboxFolderStatistics Objects

Finally run

Get-MailboxFolderStatistics <mailbox name> | ft Identity, FolderSize, ItemsinFolder

to gather the folder sizes and the item count of a mailbox.

Hopefully these commands will give you a basic idea, how to use various cmdlets to format your mailbox size reports!

Run Exchange 2010 Management Console on Microsoft Windows 8 x64

I’ve got a Windows 8 x64 workstation and after installing the Exchange Management Console, I could not start it. The workaround is to create a new .cmd file, insert the following code

set __COMPAT_LAYER=RUNASINVOKER
set COMPLUS_Version=v2.0.50727
"C:\Program Files\Microsoft\Exchange Server\V14\Bin\Exchange Management Console.msc"
exit

save it and run it.

The first line prevents the application from requiring User Account Control (UAC) elevation by ignoring the application manifest. In Windows Vista and later, an application can be coded to require UAC elevation. If you try to run it as a non-administrator, you get asked for an administrator username and password, and if you don’t provide them the application doesn’t start.

The second line sets the environment variable called COMPLUS_Version to v2.0.50727, which forces everything after that to run in .NET 2.0.

Convert a Linked Mailbox to a Shared Mailbox in Microsoft Exchange 2010

Sometimes, you may need to convert a linked mailbox to a shared one. A linked mailbox is a mailbox that is accessed by a user in a separate, trusted forest. You cannot convert it directly to a shared mailbox. First convert it to a usual user mailbox and then to a shared one. You cannot convert it via Exchange Management Console (EMC) gui, so open up an Exchange Management Shell (EMS) and type in:

Set-User -Identity <e-mail address> -LinkedMasterAccount $null

and then

Set-Mailbox <Mailbox Name> -Type shared

and finally give the appropriate permissions to the user

Add-MailboxPermission <Mailbox Name> -User "<domain\username>" -AccessRights FullAccess

Add-ADPermission Research -User "<domain\username>" -ExtendedRights Send-As

Create a Shared Mailbox in Microsoft Exchange 2010

A shared mailbox is a common mailbox that a group of users can open to read and send e-mail messages. It allows users to share a common calendar or a shared contact list. But how to create shared mailboxes in Microsoft Exchange 2010, since the Exchange Management Console (EMC) gui does not give you such an option? If you try to create a new mailbox, the only options are: User Mailbox, Room Mailbox, Equipment Mailbox and Linked Mailbox.

New Mailbox Wizard

New Mailbox Wizard

First execute the Exchange Management Shell (EMS) from the Microsoft Exchange Server 2010 menu.

Microsoft Exchange Server 2010 Menu

Microsoft Exchange Server 2010 Menu

The shell environment opens up

Exchange Management Shellvvv

Exchange Management Shell

A. Create a new Shared Mailbox

Type in the following cmdlet:

New-Mailbox -Name <Maibox Name> -Alias <Alias> -OrganizationalUnit "<OU path>" -Database "<Database>" -UserPrincipalName <E-mail Address> -Shared

And give the appropriate permissions to the user

Add-MailboxPermission <Mailbox Name> -User "<domain\username>" -AccessRights FullAccess

Add-ADPermission <Mailbox Name> -User "<domain\username>" -ExtendedRights Send-As

For example, I will create a new mailbox called Info and setup user Secretary to have access.

New-Mailbox -Name Info -Alias info -OrganizationalUnit "mydomain.local/myCompany/myDepartment" -Database "DB1" -UserPrincipalName info@mycompany.gr -Shared
Add-MailboxPermission Info -User "mydomain\secretary" -AccessRights FullAccess
Add-ADPermission Info -User "mydomain\secretary" -ExtendedRights Send-As

Full detailed syntax and parameters are in this Microsoft link.

B. Convert a User Mailbox to a Shared one

Type in the following cmdlet:

Set-Mailbox "<Maibox Name>" -Type shared

And give the appropriate permissions to the user as well

Add-MailboxPermission <Mailbox Name> -User "<domain\username>" -AccessRights FullAccess

Add-ADPermission <Mailbox Name> -User "<domain\username>" -ExtendedRights Send-As

For example, let’s suppose that we have created a user mailbox called Helpdesk and we need to convert it to a shared mailbox and give access right to user Operator.

Set-Mailbox "Helpdesk" -Type shared
Add-MailboxPermission Helpdesk -User "mydomain\operator" -AccessRights FullAccess
Add-ADPermission Helpdesk -User "mydomain\operator" -ExtendedRights Send-As

Full detailed syntax and parameters are in this Microsoft link.

The last two commands about access and send-as permissions can be configured from EMC gui, by selecting the mailbox and clicking on “Manage Send As Permission..” or “Manage Full Access Permission…” at the right pane of the window.

Access and Send-As Permissions

Access and Send-As Permissions