Friday, February 11, 2011

How to do a database Off-Line defrag in Exchange 2010

UPDATED 17/02/2011
Folks,
to be honest..the database's defrag is pretty the same as Exchange 5.5 version, but always is useful to remember the commands:

First of all , remember that:
Seeding is required under the following conditions:
  • When a new passive copy of a database is created. Seeding can be postponed for a new mailbox database copy, but eventually, each passive database copy must be seeded in order to function as a redundant database copy.
  • After a failover occurs in which data is lost as a result of the passive database copy having become diverged and unrecoverable.
  • When the system has detected a corrupted log file that cannot be replayed into the passive copy of the database.
  • After an offline defragmentation of any copy of the database occurs.
  • After the log generation sequence for the database has been reset back to 1.
So, we need to suspend the database copy first:

1-               Suspend-MailboxDatabaseCopy MST1DB1\MBXSERVER(passive) -Confirm:$false
2- Then all get the phisical database path
                  Get-MailboxDatabase "MST1DB1" | fl name,*path*
Name                    : MST1DB1
EdbFilePath             : E:\MST1DB1\MST1DB1.edb
LogFolderPath           : E:\MST1DB1logs
TemporaryDataFolderPath :
3- Dismount the database
                 Dismount-Database mst1db1 -confirm:$false
4- The defrag commnad (eseutil /D) , the /t switch redirects the temporary file to another disk (with enough free space ..of course)
                  eseutil /d E:\MST1DB1\MST1DB1.edb /t e:\def\temp.edb
Extensible Storage Engine Utilities for Microsoft(R) Exchange Server
Version 14.01
Copyright (C) Microsoft Corporation. All Rights Reserved.
Initiating DEFRAGMENTATION mode...
            Database: E:\MST1DB1\MST1DB1.edb
                  Defragmentation Status (% complete)
          0    10   20   30   40   50   60   70   80   90  100
          |----|----|----|----|----|----|----|----|----|----|
          ...................................................

Moving 'e:\def\temp.edb' to 'E:\MST1DB1\MST1DB1.edb'... DONE!
Note:
  It is recommended that you immediately perform a full backup
  of this database. If you restore a backup made before the
  defragmentation, the database will be rolled back to the state
  it was in at the time of that backup.
Operation completed successfully in 9.656 seconds.

5- Finally mount the database
                         Mount-Database mst1db1

6- Update the databases copy
  
  Update-MailboxDatabaseCopy MST1DB1\MAILBOX SERVER(passive)  -DeleteExistingFiles
7- Check the database and copy status and check the database file's size in active server and in all passive servers
                  
                          Get-MailboxDatabaseCopyStatus -Server MAILBOX SERVER(passive)
 ESEUTIL is an Exchange database utility located in the \bin directory of Exchange server. A number of switches are possible with ESEUTIL:
  • ESEUTIL /D – Used for offline defragmentation of a Database
  • ESEUTIL /R – Used for recovery purposes of a Database
  • ESEUTIL /g – Performs an integrity check  of a Database
  • ESEUTIL /k – Performs a checksum test of a Database
  • ESEUTIL /p – Repairs a Database when it’s corrupt (and beyond recovery)
  • ESEUTIL /m – can dump header information of a Database and Log Files
  • ESEUTIL /y – can copy large files like Mailbox Database files efficiently
  • ESEUTIL /c – Is used to ‘hard recover’ a database during an online backup

Rollup Installation With DAG Maintenance Scripts In Exchange 2010 SP1

Installing update rollups on DAG members was never a straight forward task like clicking Next, Next. We had to make sure that all the active databases have been moved to a different DAG member, activation of all databases on the server to be patched is blocked, mailbox database copy is suspended etc. If we had Forefront running, it had to be disabled as well.

To make patching DAG members easier, Microsoft has two new scripts in the “Scripts” folder of Exchange 2010 SP1. StartDAGServerMaintenance.ps1 and StopDAGServerMaintenance.ps1.
The StartDAGServerMaintenance.ps1 script does the following:
  • Run Suspend-MailboxDatabaseCopy for each database copy hosted on the DAG member.
  • Pauses the node in the cluster, which prevents it from being and becoming the Primary Active Manager.
  • Sets the value of the DatabaseCopyAutoActivationPolicy parameter on the DAG member to Blocked.
  • Moves all active databases currently hosted on the DAG member to other DAG members.
The StopDAGServerMaintenance.ps1 script does the following:
  • Run Resume-MailboxDatabaseCopy for each database copy hosted on the DAG member.
  • Resume the node in the cluster, which will enables full cluster functionality for the DAG member.
  • Sets the value of the DatabaseCopyAutoActivationPolicy parameter on the DAG member to Unrestricted.
In order to install a rollup on 2010 SP1 (UR1 at the time of writing), follow the steps below.
  • Run the StartDAGServerMaintenance.ps1 script from the “Scripts” folder with the –ServerName switch before patching the DAG member. Forefront will have to be disabled manually.
  • Use the -whatif switch to test the script



  • Install update rollup, make sure that it is run from an elevated command prompt, read my article.
  • Run the StopDAGServerMaintenance.ps1 script with the –ServerName switch after patching the DAG member. Enable forefront manually.


Enjoy....and patch your servers smoking a big cigarette

-Dario

Thursday, February 10, 2011

Cannot add users to the BlackBerry Enterprise Server 5.0 in an environment that includes Microsoft Exchange 2010 SP1

Hi All,,
An issue may exist where users cannot be added to the BlackBerry Enterprise Server from the BlackBerry Administration Service console in an environment that includes Microsoft Exchange 2010. When attempting to add users, they will not appear in the console when searched and cannot be added using the SMTP email address either.
Cause:
The Microsoft Exchange 2010 SP1 Server in the organization does not include a public folder database and the BlackBerry Mail Store Service cannot connect to it. The BlackBerry Mail Store Service is designed to connect to the messaging servers in the organization's environment and retrieve the contact information that the BlackBerry Administration Service requires to search for user accounts.

BlackBerry service for existing users is not affected and they continue to operate normally.
There is a work around in order to fix that issue, please check the RIM article KB24470.

In another hand...check this RIM Compatibility Matrix for BES for Microsoft Exchange



The reference is for the KB mentioned earlier..

Be care , be happy...

-Dario

How to get the mailbox last logon user and the client in Exchange 2003 & Exchange 2010

Hi all,
here a simple script to get the user last logon information for Exchange 2003 and Exchange 2010:

Exchange 2003:

#$erroractionpreference = "SilentlyContinue"
$user=Import-CSV "c:\serviceMBX.csv"
$report="c:\\ReportSvcMBXLastLogon.csv"

Clear-Content $report
add-content $report "Handle,MailboxDisplayName,LoggedOnUserAccount,LogonTime,ClientMode,ClientVersion,ServerName"


foreach ($usr in $user)
{

$identity= $usr.handle

$script=get-mailbox -identity $identity | select-object legacyExchangeDN,servername

if($error.count -gt 0){
$string ="User " + $identity  + " doesn't exist in AD"
add-content $report -VALUE $string
write-host "User " $identity "  doesn't exist in AD"

$error.clear()
}
else
{
foreach ($u in $script)
{


$legDN=$u.legacyExchangeDN
$serverEx=$u.servername


$lastL=get-wmiobject -class Exchange_logon  -Namespace "root\MicrosoftexchangeV2"  -Computer $serverEx -Filter "MailboxLegacyDN='$legDN'"|select-object  MailboxDisplayName,LoggedOnUserAccount,LogonTime,ClientMode,ClientVersion,ServerName
write-host $legDN
write-host $serverEx
write-host $identity


foreach ($2k3 in $lastL) {
              
               $displN=$2k3.MailboxDisplayName
               $LOnUser=$2k3.LoggedOnUserAccount
               if ($2k3.LogonTime -ne $null) {
                 $LOnTime=[System.Management.ManagementDateTimeConverter]::ToDateTime($2k3.LogonTime)
  }else{
   $LOnTime=$2k3.LogonTime
  }
               $cliMode=$2k3.ClientMode
               $cliVer=$2k3.ClientVersion
              
                        
             
    }

}}
$string=$identity + "," + $displN + "," + $LOnUser + "," + $LOnTime + "," + $cliMode + "," + $cliVer + "," +$serverEx
add-content $report -VALUE $string


}
###### end code

Client Mode:

1=classic

2=Cached

Client Version: 

7.0 = Outlook 97
8.0 = Outlook 98
9.0 = Outlook 2000
10.0 = Outlook 2002
11.0 = Outlook 2003
12.0 = Outlook 2007
14.0 = Outlook 2010 

Exchange 2010:

For last logo user:
For last client connected on the mailbox:



Enjoy!

-Dario

Wednesday, February 9, 2011

Outlook 2003 Free/Busy issues in Exchange 2010 environmet

Hello everyone,

below is an extract from a great article
(see http://msexchangeteam.com/archive/2010/04/23/454711.aspx)

Public Folders, Offline Address Book and Free/Busy

Outlook 2003 uses the Public Folders free/busy messages to determine availability in the Calendar and as the source for Offline Address Book synchronization. If Public Folders are not configured during Exchange Server 2010 setup, Offline Address Book and Free/Busy will not be available to Outlook 2003 users. These users will encounter connection errors.
If free/busy Public Folders folder is not replicated to Exchange Server 2010, users will encounter the following:
Users who use Outlook 2003 cannot publish their free/busy data in Exchange Server 2010 or in Exchange Server 2007http://support.microsoft.com/kb/945602
If clients inside the organization or connected via VPN/RAS, and the organization uses a Proxy server, the Client Access Server should be listed in the "Bypass proxy server for local addresses" configuration.
Error message when Outlook synchronizes an offline address book with Exchange Server 2007 and Exchange Server 2010: "0x8004010F"http://support.microsoft.com/kb/939765
Also, if there are missing address book list objects or missing or incorrect address lists, the following may occur:
An error occurs when you try to synchronize the offline address list on an Exchange Server server while you are using Outlook 2003: "0x8004010F" http://support.microsoft.com/kb/905813

Opening Additional Mailboxes

Delegate Access issues, opening other user's folders or mailboxes are a common operation in the enterprise. Outlook 2003 users may encounter issues, if the environment is not properly prepared for their use:
Office Outlook 2003 does not connect to two or more additional mailboxes in a mixed Exchange Server 2007 and Exchange Server 2010 environment http://support.microsoft.com/kb/978777
An error occurs when an Exchange server 2003 user tries to open more than one delegate mailboxes of Exchange Server 2010 in Outlook 2003 http://support.microsoft.com/kb/979690
Enjoy!

-Dario

How to request a new certificate manually with certreq.exe tool ussing a INF file and a SAN

Once a time I was really lost regarding how to get a new cert request from command line and I've found  this command ....this is useful for Windows 2003 Server and Windows 2008 Server.

1.Open a notepad and save as policy.inf and copy the below lines:

Policy.INF file

[Version]
Signature= "$Windows NT$"
[NewRequest]
Subject= "CN =server1.mycompany.com;OU=MyCompany IT;O=My Company Inc;L=Saavedra;S=CABA;C=AR"
KeySpec = 1 
KeyLength = 1024  
Exportable = TRUE
MachineKeySet = TRUE
SMIME = FALSE
PrivateKeyArchive = FALSE
UserProtected = FALSE   
UseExistingKeySet = FALSE
ProviderName = "Microsoft RSA Schannel Cryptographic Provider"
ProviderType = 12
RequestType = PKCS10 
KeyUsage = 0xa0   
[EnhancedKeyUsageExtension]
OID=1.3.6.1.5.5.7.3.1   
[RequestAttributes]
SAN:DNS=name1.mycompany.com&DNS=name2.mycompany.com&DNS=name3.mycompany.com&DNS=name4.mycompany.com&DNS=name4.mycompany.com&DNS=name5.mycompany.com



2. From command line and with Local Administrator permissions, type:

certreq -new Policy.inf c:\certs\server1New.txt
3. Submit the request file to the Certificate Authority (CA) and have the CA generate the certificate

4.After receiving the certificate , accept it
certreq -accept c:\certs\cert.cer
 This will install the certificate in your certificate personal folder..

Further information be free to contact me at dario.may@gmail.com

-Dario

How to install a Certificate in Exchange 2007 CAS Server

Gooood night for all...
A commercial certificate is only needed if the Client Access server will service client requests from the Internet or to facilitate un-trusted cross-forest communication between Client Access servers.

1.Connect to the server via Remote Desktop and log on with an account that has local administrative access and has been delegated the Exchange Server Administrator role (or higher).

Note:
For more information about using the certificate tasks, see the Exchange 2007 Online Help topic Creating a Certificate or Certificate Request for TLS .
 
 Note:
If generating a certificate that will use Subject Alternative Names, be sure that the certificate’s principal name will be the one that the clients (for example, Outlook) will use to connect (for example, mail.contoso.com). In other words, do not list the Autodiscover namespace as the principal name in the certificate.

2. Generate the certificate request by using the following Exchange Management Shell command. The DomainName parameter includes the principal URL, Autodiscover FQDN, and the server FQDN. The FriendlyName parameter matches the principal URL that is used by Outlook Web Access and Outlook Anywhere.

New-ExchangeCertificate -GenerateRequest -SubjectName “c=US,o=MyCompany,cn=<Primary Namespace>.mycompany.com” -DomainName =<Primary Namespace>, <Secondary Namespace(s)>, <ServerName>, <ServerName>.domain.mycompany.com, <Location Code>NLB.mycompany.com -FriendlyName <Primary Regional Namespace>.webmail.mycompany.com -privatekeyexportable:$true -path c:\cert.txt

 Note:
An example of [Full Subject Path] is "c=US, o=Company, cn=CAS01.contoso.com".

Note: In Windows Vista, the Windows RPC/HTTP client-side component required that the Subject Name (Common Name) on the certificate match the “Certificate Principal Name” configured for the Outlook Anywhere connection in the Outlook profile. This behavior was changed in Windows Vista Service Pack 1 (SP1). Therefore, as a best practice, make sure that the Subject Name (Common Name) on the certificate match the “Certificate Principal Name” configured for the Outlook Anywhere connection. 

3. Submit the request file to the Certificate Authority (CA) and have the CA generate the certificate.
4. After receiving the certificate, import and enable the certificate by running the following Exchange Management Shell command where [services] can be POP, IMAP, IIS, or a combination:

Import-ExchangeCertificate -path c:\newcert.cer | Enable-ExchangeCertificate -services "IIS,IMAP,SMTP"
5. You will prompted to “Confirm; Overwrite existing default SMTP certificate”. Respond “L” for “No to all”

6. Require SSL on the default Web site, do the following:
  1.  Open Internet Information Services (IIS) Manager.
  2. Expand the Server Node object and the Sites node.
  3. Click the Default Web Site.
  4. In the middle pane, double-click SSL Settings.
  5. Verify Require secure channel (SSL) is enabled.
 Note:
If you require 128-bit encryption, also verify that Require 128-bit encryption is enabled.

Tuesday, February 8, 2011

How to modify the Users Storage Quota from CSV file and Database Quota Limits in Exchange 2010

Hi all,
may be you will need to adjust your Database's storage Quota Limits on the fly, but please think about your users limits first!!! in order to avoid hundred of helpdesk calls from crazy users (the end of the world!!!) first use one of my post to get the user mailbox size, then use the below code with the csv format:

For user side:
Copy/Paste the below format in a csv file

Identity,WQ,ProhSQ,ProhSRQ
user1,358400000,378880000,399360000


that means..
WQ= Warning Quota Limit ---> 358400000 bytes (350 MB)
ProhSQ = Prohibit Send Quota Limit ---> 378880000 bytes (370 MB)
ProhSRQ = Prohibit Send and Receive Quota Limit ---> 399360000 bytes (390 MB

Copy the code below in a ps1 file in order to set those storage limits to the user list

Import-csv users.csv | foreach {Set-Mailbox -Identity $_.identity -UseDatabaseQuotaDefaults $false  -ProhibitSendQuota $_.ProhSQ -ProhibitSendReceiveQuota $_.ProhSRQ  -IssueWarningQuota $_.WQ }

For Database side:

Set-MailboxDatabase  -IssueWarningQuota 378880000 -ProhibitSendQuota 399360000  -ProhibitSendReceiveQuota 436224000 -Identity 'DB01'

Bear in mind, the users always will use all the space or storage available...be tough

Enjoy,
-Dario

Friday, February 4, 2011

Move Request Exchange 2010 - Can we increase the number of simultaneous Remote/Local Move Request ?

The answer is yes..of course.. because:
The Mailbox Replication Service (MRS), which resides on all Microsoft Exchange Server 2010 Client Access servers, is the service responsible for moving mailboxes, importing and exporting .pst files, and restoring disabled and soft-deleted mailboxes.
Because MRS performs several tasks, you can throttle it to maintain the overall health of your Exchange organization. Although each instance of MRS has its own configuration settings, each instance of MRS is aware of the tasks that other instances of MRS are processing. MRS throttling is controlled by the configuration file MSExchangeMailboxReplication.exe.config. By default, this configuration file is located on all Client Access servers in the same folder where Exchange is installed:
 <Exchange Installation Path>\Program Files\Microsoft\Exchange Server\V14\Bin\MSExchangeMailboxReplication.exe.config.

Modify those values to have 25 move-request simultaneously.

MaxActiveMovesPerSourceMDB = "25"
MaxActiveMovesPerTargetMDB = "25"
MaxActiveMovesPerSourceServer = "50"
MaxActiveMovesPerTargetServer = "25"

MaxTotalMovesPerMRS = "100"

Do this change in all CAS servers in your environment and restart the Microsoft Exchange Mailbox ReplicationService.From PS (restart-service MSExchangeMailboxReplication)

Explanation:
  • Navigate to <Exchange Installation Path>\Program Files\Microsoft\Exchange Server\V14\Bin
  • Open the MSExchangeMailboxReplication.exe.config file using a text editor such as Notepad
  • Navigate to the MRSConfiguration section. You can edit the following properties:
    • MaxRetries    This property specifies the maximum number of times MRS will attempt to perform a task after encountering a transient failure. You can specify a value from 0 through 1000. The default value is 60.
    • MaxCleanupRetries    This property specifies the number of times that MRS should attempt to clean up a task. If the maximum number of attempts is reached, the task fails. You can specify a value from 0 through 100. The default value is 5.
    • MaxStallRetryPeriod    This property specifies the maximum duration for which MRS pauses while waiting for the Microsoft Exchange Information Store service to bring the target mailbox database into compliance with its configured data redundancy constraints. If the Microsoft Exchange Information Store service reports that the mailbox database is unhealthy, MRS will pause. If the maximum time is reached, the task fails. You can specify a value from 00:00:10 (10 seconds) through 05:00:00 (5 hours). The default value is 00:15:00 (15 minutes).
    • RetryDelay    This property specifies the amount of time MRS will wait before it attempts to perform a task again after a transient failure. You can specify a value from 00:00:10 (10 seconds) through 00:30:00 (30 minutes). The default value is 00:00:30 (30 seconds).
    • MaxMoveHistoryLength   This property specifies the maximum number of move histories to maintain in the mailbox. You can specify a value from 0 through 100. The default value is 2 move histories per mailbox.
    • MaxActiveMovesPerSourceMDB   This property specifies the total number of tasks MRS can perform that involve the mailbox database as a data source. Types of tasks include moving mailboxes located on the database, exporting mailbox data from mailboxes located on the database, and restoring mailbox data from the database. You can specify a value from 0 through 100. The default value is 5 concurrent tasks.
    • MaxActiveMovesPerTargetMDB   This property specifies the total number of tasks MRS can perform that involve the mailbox database as a data target. Types of tasks include moving mailboxes to the database, importing mailbox data into a mailbox located on the database, and restoring mailbox data to a mailbox located on the database. You can specify a value from 0 through 100. The default value is 5 concurrent tasks.
    • MaxActiveMovesPerSourceServer    This property specifies the total number of tasks MRS can perform that include the server as a data source. You can specify a value from 0 through 1000. The default value is 50 concurrent moves.
    • MaxActiveMovesPerTargetServer    This property specifies the total number of tasks MRS can perform that involve the server as a data target. You can specify a value from 0 through 1000. The default value is 5 concurrent moves.
    • MaxTotalMovesPerMRS   This property specifies the total number of tasks that a single instance of MRS can perform at a time. You can specify a value from 0 through 1000. The default value is 100 concurrent moves.
    • FullScanMoveJobsPollingPeriod   This property specifies how often each instance of MRS scans for new tasks. You can specify a value from 00:03:00 (3 minutes) through 1.00:00:00 (1 day). The default value is 00:10:00 (10 minutes).


Just In Case ...default values are :

<MRSConfiguration
MaxRetries = "60"
RetryDelay = "00:00:30"
MaxMoveHistoryLength = "2"
MaxActiveMovesPerSourceMDB = "5"
MaxActiveMovesPerTargetMDB = "5"
MaxActiveMovesPerSourceServer = "50"
MaxActiveMovesPerTargetServer = "5"
MaxTotalMovesPerMRS = "100"
FullScanMoveJobsPollingPeriod = "00:10:00"
MinimumTimeBeforePickingJobsFromSameDatabase = "00:00:04"
ServerCountsNotOlderThan = "00:10:00"
MRSAbandonedMoveJobDetectionTime = "01:00:00"
BackoffIntervalForProxyConnectionLimitReached = "00:30:00"
DataGuaranteeCheckPeriod = "00:05:00"
EnableDataGuaranteeCheck = "true"
DisableMrsProxyCompression = "false"
DisableMrsProxyBuffering = "false"
MinBatchSize = "100"
MinBatchSizeKB = "256" />
 see http://technet.microsoft.com/en-us/library/ff963524.aspx

Move! Move! Move!! Thanks Andy!!

-Dario

Don't forget your BES Admin account !!!! - Migrate from Exchange 2007 or 2010 in BlackBerry 5.0 environment

Hey!!,
here an useful article with all to do task for migrate your BES admin mailbox from Exchange 2003 to 2007/2010...How to migrate from Microsoft Exchange Server 2003 or 2007 to Microsoft Exchange Server 2010 in a BlackBerry Enterprise Server 5.0 environment

Particularly for Exchange 2010 migrations take care with this setting

  • New-ThrottlingPolicy BESPolicy -RCAMaxConcurrency $null.
  • Set-ThrottlingPolicy BESPolicy -RCAMaxConcurrency $null -RCAPercentTimeInAD $null -RCAPercentTimeInCAS $null -RCAPercentTimeInMailboxRPC $null -EWSMaxConcurrency $null -EWSPercentTimeInAD $null -EWSPercentTimeInCAS $null -EWSPercentTimeInMailboxRPC $null -EWSMaxSubscriptions $null -EWSFastSearchTimeoutInSeconds $null -EWSFindCountLimit $null
 And for Sp1
  • New-ThrottlingPolicy BESPolicy -RCAMaxConcurrency $null -EWSFindCountLimit $null -EWSMaxConcurrency $null.
  • Set-Mailbox "BESAdmin" -ThrottlingPolicy BESPolicy
Because RCAMaxConcurrency, EWSFindCountLimit and the EWSMaxConcurrency has been disabled,
To check which throttling policy is applied to the BESAdmin account, follow these steps:
  
      get-mailbox besadmin | fl -property throttlingpolicy
Enjoy!
-Dario