by Theresa Miller

cloud

As an Exchange administrator you are likely using Exchange Management Shell on a daily basis.  This has become a way of life for Exchange teams within organizations since the introduction PowerShell.  Prior to its formal release its codename was Monad.  Since Exchange 2007 it’s reasonable to assume that Exchange administrators have been using Exchange PowerShell commands most of the time.  From an administrator perspective I am always grabbing code and throwing it into Outlook Notes to refer back to.  Yes, I could be the only person in the world that uses Outlook notes, but that’s not the point of this blog post. Anyways, back on track.  Here are some of the Exchange commands that can be useful for your job.  All commands in this article should be run with Exchange Management Shell.
How to Get Exchange Database Whitespace – We care about database whitespace for several reasons.  Exchange databases do not automatically reduce in size when mailboxes are removed, so understanding how much free space a database has can help us understand which databases to create new users in, or which databases there may be more opportunity to move users into without using more disk space.    The following command will show you how much whitespace each of your Exchange databases has left.

Get-MailboxDatabase -Status | Sort-Object DatabaseSize -Descending | Format-Table Name, DatabaseSize, AvailableNewMailboxSpace

How to Force messages in the “Unreachable” Hub Transport Queue to Resubmit – There are rare cases where your organizational email may get stuck in your transport queues.  These could be unforeseen tragic events such as a mail gateway going down, or the receiving domain may be having issues receiving your email.  When you know that workflows are back online the following command can be run to force the stuck messages to resubmit for delivery.

Retry-Queue -Identity “servername\Unreachable” -Resubmit $true

[wp_ad_camp_1]

Mail Gateway Test with TLS – Standard Telnet tests may not always be successful when doing TLS mail tests.  If your mailgateway is linux based you can use Open SSL.  Typically this would be done by connecting to your mailgateway with Putty.  While this is not an Exchange Management Shell set of commands it is still good to have in your back pocket for TLS mail testing.

  • Connect to your gateway server through Putty and go to a command prompt.  Then type in the following command  openssl s_client -starttls smtp -connect IPAddress:25
    and press enter.

Note:  This will then initiate the connection with TLS that you need to complete your testing using the standard telnet commands.  Press enter after each of the following commands.

Get Pop3 and IMAP4 enabled/disabled on Mailboxes – Most organizations do not use POP or IMAP4.  It is possible that some internal applications require these protocols, but typically this would not be a standard connectivity type.  It is also not recommended that this be configured to be available outside of your organization, because they are not secured protocols.  Based upon this it may become important to look at your overall configuration, but also look understand which users have POP and/or IMAP enabled.  The following command will get you a list including information about both.
Get-CASMailbox -resultsize unlimited | Select-Object name,popenabled,imapenabled | export-csv – Path c:\popimap.csv -Encoding ascii –NoTypeInformation

Enable Logging or IMAP and POP – Now that you know who has POP and/or IMAP enabled make sure logging is enabled, so that further detail can be discovered about who is really using these protocols.  Additional information about protocol logging in Exchange 2013 can be found here.

Set-ImapSettings -Server “CAS01” -ProtocolLogEnabled $true
Set-PopSettings -Server “CAS01” -ProtocolLogEnabled $true

Exchange Management shell is a powerful way to approach all of your Exchange needs and these are just a few of the tool in my toolbox.  I am looking forward to hearing what you find useful in Exchange.  What’s in your Exchange Management Shell Toolbox?