Category Archives: Exchange

Exchange IIS Redirect Error

You received the error listed below after browsing to https://exchange-srv-fqdn/exchange

Server Error in ‘/’ Application.

Runtime Error

Description: An application error occurred on the server. The current custom error settings for this application prevent the details of the application error from being viewed remotely (for security reasons). It could, however, be viewed by browsers running on the local server machine.

Details: To enable the details of this specific error message to be viewable on remote machines, please create a <customErrors> tag within a “web.config” configuration file located in the root directory of the current web application. This tag should then have its “mode” attribute set to “Off”.

<!– Web.Config Configuration File –><configuration><system.web><customErrors mode=”Off”/>

</system.web>

</configuration>

Notes: The current error page you are seeing can be replaced by a custom error page by modifying the “defaultRedirect” attribute of the application’s configuration tag to point to a custom error page URL.

<!– Web.Config Configuration File –><configuration><system.web><customErrors mode=”RemoteOnly” defaultRedirect=”mycustompage.htm”/>

</system.web>

</configuration>

Image of the error listed above:


To resolve this error follow Microsoft directions on “How to recreate the legacy Exchange Virtual Directories in Exchange 2010?”.  If that does not resolve the problem than open the web.config file located on the CAS server’s “C:\Program Files\Microsoft\Exchange Server\V14\ClientAccess\Owa”.  Search for:

<httpRedirect enabled=”false”

Then delete the entire line.  Save the web.config file and test it again.  This problem is caused because the web.config file is overriding the settings located on the applicationHost.config file listed in the MS link above.  Below is a quick video showing the issue and resolution.  Hope that helps.


Mailboxes not logged into within the last 30 Days

Below is a powershell command that will return all mailboxes not logged into within the last 30 days:

Get-MailboxStatistics -Database “Server\Database” | where {$_.LastLogonTime -lt (Get-Date).AddDays(-30)} | ft DisplayName, LastLogonTime, LastLoggedonUserAccount, Servername


Retrieving Disconnected Mailboxes from an Exchange Server

The command below will retrieve disconnected / deleted mailboxes from a given Exchange server using Powershell.

Get-MailboxStatistics -Server <server> | where { $_.DisconnectDate -ne $null } | Select Displayname, DisconnectDate, TotalItemSize -Autosize

Below is a Powershell command to retrieve disconnected mailboxes for the last 7 days:

Get-MailboxStatistics -Server corp2k7mail | Where-Object {$_.DiscconnectDate -gt (Get-Date).AddDays(-7)} |ft Displayname, ServerName, DatabaseName, TotalItemSize –Autosize

To reconnected a disconnected mailbox to a user object still in AD type:

Connect-Mailbox -Database <Mailbox_Database> -Identity <Deleted_Mailbox>


Determining Exchange’s Database Size

An easy way to determine the Exchange’s actual database size is to look for Event ID 1221 under Windows application logs.  For example, If the database size is 100gigs and event 1221 is reporting 30000 megabytes free space; then your actual database size is 70gigs.  As a result, you can compact the database to 70gigs from 100gigs if you ran an offline defragmentation on the database.


Exchange DB and Mailbox Total Count

I was recently ask to provide the total number of Exchange mailboxes.  Simple question, but I notice one of my co-workers working on a powershell cmd to retire the data.  Below is the powershell cmd that would retire that data:

 (Get-Mailbox).count

Or, just open the Exchange Management console click the Mailbox icon located under the Recipient Configuration.  Then look at the total number of objects located at the top right corner.

But, what about the total number of Exchange databases:
(Get-Mailbox -ResultSize:Unlimited | Group-Object -Property:Database).count

The powershell cmd below returns all of the databases names:
(Get-Mailbox -ResultSize:Unlimited | Group-Object -Property:Database | Select-Object -Property:Name)

The powershell cmd below returns total mailbox count per database and the database name:
(Get-Mailbox -ResultSize:Unlimited | Group-Object -Property:Database | Select-Object -Property:Count,Name)


Configuring Exchange’s MaxMessageSize

The instructions below explain how to change Exchange’s maximum email message size.  Microsoft’s best practices recommends having the send and receive connectors configured with the same sizes.  In the example below I’m configuring Exchange to allow a max email size of 21MB.

  1. Let’s start at the top by changing the setting under Organization Configuration, Hub Transport, Global Settings.  Then modify the maximum receive and send size.  (Image Below)

    Powershell version to step 1 is:
    To view current settings: Get-TransportConfig |Ft MaxSendSize, MaxReceiveSize
    To modify the settings: Get-TransportConfig | Set-TransportConfig -MaxSendSize 21MB -MaxReceiveSize 21MB
  2. Next is to configure all of your send connectors with 21MB.  The connectors reside under the Organization Configuration, Hub Transport, Send Connectors.  The image below shows a total of 4 connectors that will be modified.

    Powershell version to step 2 is:
    To view current settings: Get-SendConnector | ft Name, MaxMessageSize
    To modify the settings: Get-SendConnector | Set-SendConnector -MaxmessageSize 21MB
  3. Your next stop will be the Receive Connectors located at Organization Configuration, Server Configuration, Hub Transport.  Make sure to change the settings on all receive connectors you may have.

    Powershell version to step 3 is:
    To view current settings: Get-ReceiveConnector | ft Name, MaxMessageSize
    To modify the settings: Get-ReceiveConnector | Set-ReceiveConnector -MaxmessageSize 21MB
  4. You may or may not need to configure your employees Message Size Restrictions if you have a policy in place for that.  In my case, I don’t have to change any settings because my employees size restrictions are applied from the items listed above.
  5. The following setting needs to be done on all of your Hub Transports servers.  Modify the web.config file to match 21MB settings listed above.  The web.config file can be found at c:\Program Files\Microsoft\Exchange Server\ClientAccess\Owa\web.config.  The line you’re modify is:
    <system.web>
      <httpRuntime maxRequestLength=”21504” />
  6. The “Microsoft Exchange Transport” service needs to be restarted after modifying the web.config file.  By restarting the service you force the settings adjusted on step 5.  Please note, by restarting this service your Hub Transport will stop routing email until the service has started again.  Your employees should not notice the short outage but you’ve been warned.
    You can use the PowerShell CMD to restart the service:restart-service -Name “MSExchangeTransport”
  7. Test the settings configured above by sending an email with an attachment of 21MB to confirm everything is working as planned.  Below is a nice  command to create a txt file of any size:

    fsutil file createnew
    Example:
    fsutil file createnew c:\20MBfile\20MBfile.txt 20971520

By using PowerShell you can accomplish the same results in less time.  If you notice I didn’t give a PowerShell command for step 4 because in my situation I didn’t require it.  However, the command to do step 4 is below.  BUT USE WITH CAUTION!

This command will set every employee’s setting to 21MB:

Get-MailBox | Set-Mailbox -MaxSendSize 21MB -MaxReceiveSize 21MB

This command will set only the employee you choose:

Get-MailBox  | ft Name, MaxSendSize, MaxReceiveSize
Set-MailBox <employees’s email> -MaxSendSize 21MB -MaxReceiveSize 21MB

This command will set the every employee’s setting to unlimited.  Note, by setting it to unlimited the employee will be force to comply with the setting configured in steps 1 thru 3.

Get-MailBox | Set-Mailbox -MaxSendSize unlimited -MaxReceiveSize unlimited

AS ALWAYS, TEST EVERY CHANGE BEFORE MODIFYING YOUR PRODUCTION ENVIRONMENT!


Exchange Performance Monitor Counters

The best way to determine your Exchange server’s performance is to capture the data over a period of time.  By doing this you will be able to determine:

  1. How much emails are sent / received.
  2. The busiest time throughout the day for sending and receiving emails.
  3. If the server’s hardware is under or over utilized.
  4. Email storage growth per day or month.

An example of the data I collect on a daily bases tells me my current company processes 33,000 emails per day.  The peak time for sending emails is at 9:40am to 9:55am and then again at 3pm to 3:30pm.  The peak time for email’s received is 9 to 10am.

This list can go on and on with the possibility.  Anyhow, below are links to Microsoft website with the details on what to configure.  Enjoy!

Monitoring Common Counters

Monitoring Mailbox Servers

Monitoring Hub Transport Servers

Monitoring Client Access Servers

Monitoring Unified Messaging Servers

Exchange 2010 Common Counters


Wiping a Mobile Phone using EMS

To Wipe an Exchange active sync device please follow the instructions listed below:

  1. The first step is to get the identity of the device you are going to wipe.  The command listed below will retrieve that information:
    Get-ActiveSyncDeviceStatistics -Mailbox <employees name>
  2. Please make a note of the device ID.  Image below:
  3. Now lets wipe the device using the following cmd:
    Clear-ActiveSyncDeviceStatistics -Identity <Enter the identity from line 2 listed above>
    Example:
    Clear-ActiveSyncDeviceStatistics -Identity mike.tirado@example.com\AirSync-TestActiveSyncConnectivity-1380560068
  4. Let’s confirm that the wipe was successful by typing:
    Get-ActiveSyncDeviceStatistics -Mailbox <employees name>
  5. To remove the device from the employees profile type:
    Remove-ActiveSyncDevice -Identity <Enter the identity from line 2 listed above>

Sending a copy of NDR’s to the Postmaster Mailbox

Troubleshooting Non-Delivery Reports (NDR) is a normal administrative task of anyone who supports emails.  The information provided on an NDR will help resolve the issue.  Getting the NDR’s would require the recipient to send a copy of the email to the administrator.  Which is also considered to be retroactive because you’re not proactively solving the issue(s).

Or, you can configure a mailbox to automatically receive a copy of those NDR’s.  This method allows the administrator to troubleshoot and proactively resolve issues before receiving any tickets.

  1. To make sure the company has not already setup a postmaster account open powershell and type:
    • Get-TransportServer

      The ExternalPostmasterAddress has not been configured because it’s empty.
  2. To assign a mailbox type the following command:
    • Set-TransportServer -ExternalPostmasterAddress postmaster@domain.com
      Excute the command below to make the change on all the Hub Transport
    • Get-TransportServer | Set-TransportServer -ExternalPostmasterAddress postmaster@domain.com:
  3. Now you must associate an internal mailbox to receive the NDR’s.
    • Set-OrganizationConfig -MicrosoftExchangeRecipientReplyRecipient postmaster@domain.com

Make sure to create a postmaster mailbox for the email delivery.  This is done the same way a users mailbox is created.

References: http://technet.microsoft.com/en-us/library/bb400930(EXCHG.80).aspx


Duplicating Exchange Receive Connectors on a 2nd Hub Transport

You may want to duplicate the receive connectors for your Hub Transport (HT) servers if your company has more than one HT.  This would eliminates a single point of failure with your HT’s receive connectors.  The company I work for only allows approved internal IP’s to send email to Exchange for relays.  An example of this is a server sending out reports to Exchange for recipient delivery.  As a result, any emails received from a non-approve servers will fail.  The approved list of IP’s can add up to the hundreds, depending on your organization size.  We currently have 150+ approved IP’s for internal email relay. 

The purpose of the script listed below is to duplicate a receive connector on a second HT with minimum effort on the Exchange Administrator.

To retrieve the existing Receive connectors in your Exchange organization please enter:

Get-ReceiveConnector

Now, here’s the script to copy an existing receive connector:

$ReceiveCTR = Get-ReceiveConnector “<HT-Srv-Name>\<ReceiveConnectorName>”
$ReceiveCTR.RemoteIPRanges
New-ReceiveConnector -Name ‘Name-of-the-ReceiveConnector’ -Usage ‘Internal’ -Server ‘2nd-HT-Srv-Name’ -RemoteIPRanges $ReceiveConnector.RemoteIPRanges

Here’s an example of the process:

Get-ReceiveConnector

We will be duplicating the receive connector “Test” located on corpmailxxx on corpmailxxx1. 

$ReceiveCTR = Get-ReceiveConnector “CORPMAILXXX\Test”
$ReceiveCTR.RemoteIPRanges

New-ReceiveConnector -Name ‘Test’ -Usage ‘Internal’ -Server ‘CORPMAILXXX1’ -RemoteIPRanges $ReceiveCTR.RemoteIPRanges

Lets confirm that the receive connector has been duplicated by entering the powershell CMD:

Get-ReceiveConnector

References:

http://technet.microsoft.com/en-us/library/bb690954.aspx#Shell