Category Archives: Microsoft

Exchange SP2 Upgrade

The instructions below will guide you though the SP2 upgrade for Exchange 2010.

Perquisites:

  • Make sure all users have been logged off the server before proceeding with the upgrade.  If an employee is logged into the server you may receive an error or similar to:
    “Setup cannot continue with the upgrade because the ‘mmc’ (7060) process (ID: ) has ‘Microsoft.EnapIn.Esm.dll’ loaded. Close the process and restart setup.” 

    Take note of the process ID number 7060 listed above.  Open task manager and end task the application with the same process ID.  You may then restart the SP2 installation.

  • Do Not use the EMS (Exchange management Shell) for the upgrade.  If you do the installation will fail with a similar error to the one listed above.
    _
  • If you are running a DAG on the Mailbox role please failover the database(s) before proceeding with the upgrade.

Installation Instructions:

  1. Confirm the “Windows Management Instrumentation” service is set to Automatic and is currently started.
    _
  2. Open PowerShell in administrator mode and enter:

    “ServiceControl.ps1 AfterPatch”If an error is returned please enter the cmd listed below:
    “Set-ExecutionPolicy RemoteSigned” and then run the “ServiceControl.ps1 AfterPatch” cmd.
    _
  3. Confirm the Execution policy is set to “Undefined” by entering the following CMD:
    “Get-ExecutionPolicy -list”
    _
    If an ExecutionPolicy has a setting other then “Undefined” please enter the following CMD:
    “Set-ExecutionPolicy Undefined”
  4.  Navigate to the Exchange SP2 directory to begin the SP2 upgrade and then enter following CMD:
    “Setup /Mode:Upgrade /InstallWindowsComponents”
    ([http://technet.microsoft.com/en-us/library/hh529928.aspx])
    _
  5. After the installation has completed please proceed to with the installation of Rollup 2 by using powershell in administrator mode.  Then execute the following msp file “Exchange2010-KB2661854-x64-en.msp”
    _
  6.  After the installation has completed please restart the server.

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.


DFS Error

If you enter counter the DFS error:

“\\domain.com\namespace: The namespace cannot be queried. Access is denied”

then run the following command:

“dfsutil /clean /server:servername /share:sharename /verbose”

That should have resolve your problem.  If not then look at the following Microsoft KB:

http://support.microsoft.com/kb/977511


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.


ADComputer Powershell Cmd’s

Have you ever had to produce a report on what service pack your computer/servers have installed? Or, the location of the computer’s OU?  Or a list of your servers IP’s?  Below are sample powershell cmd using ADComputer.

Let’s start with the basic: To get powershell examples, help type:

Get-help Get-ADComputer -examples

Now let’s look at a computers properties:

Get-ADComputer <ComputerName> -Properties *

This will produce all the active directory attributes relate to the computers on the left and the information of those attributes on the right (image below).  This information will be used to fill in the -properties information for the powershell cmds listed below.

Below is one of the Get-help examples provide to us:

Get-ADComputer -Filter ‘Name -like “Fabrikam*”‘ -Properties IPv4Address | FT Name,DNSHostName,IPv4Address -A

The command listed above will return the computers Name, DNShostname, and IP address.  Let’s change this command to show us the computer’s name, operating system, and service pack.

Get-ADComputer -Filter * -Properties Name, Operatingsystem, OperatingSystemServicePack | FT Name, OperatingSystem, OperatingSystemServicePack

Now let’s filter the command to show us only servers.  The command listed below will search for the word “server” in the operating system column and then display that information:

Get-ADComputer -Filter ‘Operatingsystem -like “*server*”‘ -Properties Name, Operatingsystem, OperatingsystemServicePack | FT Name, OperatingSystem, OperatingSystemServicePack

Let’s sort the information listed above by operating system and then by name:

Get-ADComputer -Filter ‘Operatingsystem -like “*server*”‘ -Properties Name, Operatingsystem, OperatingsystemServicePack | Sort-Object OperatingSystem, Name | FT Name, OperatingSystem, OperatingSystemServicePack -AutoSize

If you notice we made minor changes to customize the powershell cmd to provides us with the information we needed.


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