Category Archives: Exchange 2007

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


DistributionGroup Change from “Mail Non-Universal” to “Mail-Enabled Universal” Group

Microsoft will no longer allow the creation of mail enable non-universal groups.  This is true starting with Exchange 2007.  Why the change?  That’s because MailEnableNonUniversalGroup will not replicated to the entire AD forest.  As a result, some emails were never received to all the intended members of a distribution group.  This only occurred in an Active Directory forest with several child domains.  As a result, the only mail enable groups allowed will be Universal.  Universal groups are replicated to all global catalogs servers in the forest.  You will notice MailEnableNonUniversalGroup in Exchange 2007 or newer if you performed an upgrade from Exchange 2003 organization.  Microsoft strongly recommends upgrading all these groups to MailEnableUniversalGroup.  Here’s the EMS CMD:

To retrieve the MailEnableNonUniversalGroup names:

Get-DistributionGroup | Where{$_.RecipientType -eq “MailEnableNonUniversalGroup”}

Here’s how to change one group type:

Set-Group “<Group Name>” -Universal

Here’s how to change all the MailEnableNonUniversalGroup at once:

Get-DistributionGroup | Where{$_.RecipientType -eq “MailEnableNonUniversalGroup”} |Set-Group -Universal


Configuring ResourceCustom for A Resource Mailbox

Resource mailboxes are great option in Exchange.  But what good are they if you have to walk over to a room to see what resources are available (LCD, Video Conference, projector, etc.).  Great exercise, but no as productive as it should be.  Below is the PowerShell CMD’s that will add the resource(s):

First step is to add all the available resources you have in your company.  Here’s the PowerShell CMD to accomplish it:

Set-ResourceConfig -ResourcePropertySchema(“Room/<ResourceName>”, “Room/<ResourceName2>”)

Example: Set-ResourceConfig -ResourcePropertySchema(“Room/42in LCD”, “Room/60in LCD”, “Room/Video Conference”)

Second step is to add the resource type to a Room resource mailbox:

Set-Mailbox “<mailbox name>” -ResourceCustom (“42inLCD”) -ResourceCapacity 10

The -ResourceCapacity can be left out.  Done….