Friday, February 25, 2011

Hey dude! Where is my Isinteg in Exchange 2010 Sp1????


doesn't longer exists ...
ISInteg has offered Exchange administrators a way to check mailbox and public folder database integrity. ISInteg checks and fixes Exchange database errors that may prevent the database from mounting, prevent the user from logging on or from receiving, opening or deleting email. Curious to know what changes are coming to ISInteg in Exchange 2010 SP1? Let's take a look.

Also ISInteg is no longer a standalone program.
The functionality provided by the ISInteg tool has been rolled into two new Exchange Management Shell cmdlets:


These new ISInteg cmdlets come with some cool new functionality!

The cmdlets work with the database mounted. It's no longer required to unmount the database to perform an integrity check or fix database errors.
You can repair logical corruption at the mailbox level.
You can fix corrupt search folders.
You can fix the Provisional Fid.
You can fix Aggregate Counts.
ISInteg can now work at the database or mailbox level

How does it do that? Well, the new schema in Exchange 2010 effectively partitions the database by mailbox. So the top problems fixed by ISInteg are now mostly limited to the affected mailboxes only. Previous versions of ISInteg required the database to be offline while validation and fixing are in progress. In Exchange 2010 SP1, the ability to do these checks at the mailbox level removes the need to dismount the database. It is actually required to have ISInteg operate against an online database!

The New-MailboxRepairRequest cmdlet detects and fixes the following types of mailbox corruptions:
Search folder corruptions (SearchFolder): Repair tasks now look for all folders named in ptagSearchBacklinks, ptagSearchFIDs, and ptagRecursiveSearchFIDs and verifies that each folder exists. If the folder no longer exists, then it will remove that folder from the list.
Aggregate counts on folders that aren't reflecting correct values (AggregateCounts): Repair tasks tally all messages in a folder and keep a running total of various counts and sizes. Once the iteration is complete, it will verify the computed counts against the persisted counts on the Folders table record for the folder. If there is a discrepancy, it will update the persisted counts to reflect the computed counts.
Views on folders that aren't returning correct contents (FolderView): Repair tasks will iterate over all views for a folder and for each one, bring the view fully up to date and then reconstruct a temp copy. If there is a discrepancy between the existing view and the contents of the temp table, it will delete the view so it can be rebuilt from scratch the next time it is requested.
Provisioned folders that are incorrectly pointing into unprovisioned parent folders (ProvisionedFolder): Repair tasks can fix Provisioned folders incorrectly pointing into unprovisioned parents or vice versa.
New-MailboxRepairRequest -Mailbox <MailboxIdParameter> -CorruptionType <MailboxStoreCorruptionType[]> [-Archive <SwitchParameter>] [-Confirm [<SwitchParameter>]] [-DetectOnly <SwitchParameter>] [-DomainController <Fqdn>] [-WhatIf [<SwitchParameter>]]New-MailboxRepairRequest -Database <DatabaseIdParameter> -CorruptionType <MailboxStoreCorruptionType[]> [-Confirm [<SwitchParameter>]] [-DetectOnly <SwitchParameter>] [-DomainController <Fqdn>] [-WhatIf [<SwitchParameter>]]
Database, Mailbox and Archive:
You can repair an entire mailbox database or a specified mailbox by specifying either the Database or the Mailbox parameter. You can't use both. To repair the archive mailbox for the specified user, use the Archive switch.
(at least 1 required) you are already familiar with, we discussed them above:

You can run a repair task with multiple parameters if you separate them with a comma (as shown in the Examples section below).
DetectOnly: (Optional) The DetectOnly switch secifies that you want this command to report errors, but not fix them. You don't have to specify a value with this switch.
Other Optional Parameters: This cmdlet supports the common parameters: Verbose, Debug, ErrorAction, ErrorVariable, WarningAction, WarningVariable, OutBuffer and OutVariable. For more information, type "get-help about_commonparameters".


New-MailboxRepairRequest -Mailbox -CorruptionType SearchFolder, AggregateCounts, ProvisionedFolder, FolderView

New-MailboxRepairRequest -Mailbox administrator -CorruptionType SearchFolder, AggregateCounts, ProvisionedFolder, FolderView -WhatIf

Event Reporting
After submitting the Mailbox or Public Folder repair request, you can monitor its progress with the Event Viewer. That's right, no more text logs to weed through. The events are logged under the MSExchangeIS Mailbox Store source.

The following event IDs will be logged for repair requests:
10047 A mailbox-level repair request started
10064 A Public Folder repair request started
10048 The repair request successfully completed.
10050 The mailbox repair request task skipped a mailbox .
10059 A database-level repair request started.
10062 Corruption was detected

NOTE: in order to run this cmdlets you new belongs to below managed grop role

Just in case
Organization Management
Server Management
Recipient Management




After apply RU1 for Exchange 2007 SP3 we cannot create a Receive Connector

When we try to create a new receive connector in Exchange 2007, we received the error:

New-ReceiveConnector : Active Directory operation failed on This error is not retriab
le. Additional information: The parameter is incorrect.
Active directory response: 00000057: LdapErr: DSID-0C090B38, comment: Error in attribute conversion operation, dat
a 0, vece
At line:1 char:21
+ new-ReceiveConnector <<<< -Name 'TEST' -Usage 'Custom' -Bindings '' -RemoteIpRanges '' -Server 'TESTHCEX1'

The accepted solution is
From Exchange 2007 SP3 source and with Schema admin permissions

C:\Source\Ex2007-SP3>setup /ps
Welcome to Microsoft Exchange Server 2007 Unattended Setup
Preparing Exchange Setup
No server roles will be installed
Performing Microsoft Exchange Server Prerequisite Check
    Organization Checks              ......................... COMPLETED
Configuring Microsoft Exchange Server
    Extending Active Directory schema
    Progress                         ......................... COMPLETED

The Microsoft Exchange Server setup operation completed successfully.

After that, simply try to create the Receive connector again

new-ReceiveConnector -Name 'TESTHCEX1-Inbound Mail' -Usage 'Custom' -Bindings '' -RemoteIPRanges '' -Server 'TESTHCEX1' -PermissionGroups AnonymousUsers

Identity                                                               Bindings              Enabled

TESTHCEX1\TESTHCEX1-Inbound Mail      {}    True


Get-ReceiveConnector "TESTHCEX1-Inbound Mail" | Add-ADPermission -User "NT AUTHORITY\ANONYMOUS LOGON" -ExtendedRights "Ms-Exch-SMTP-Accept-Any-Recipient"

Identity                                      User                                   Deny   Inherited    Rights
TESTHCEX1\TESTCHEX1... NT AUTHORITY\ANON... False  False           ms-Exch-SMTP-Accept-Any-Recipient


Tuesday, February 22, 2011

How to install a certificate in Exchange 2010 using an Internal CA

Hi all,
we can install an Active Directory Certificate Services in windows server 2008, in order to configure an Internal PKI infrastructure.After that you will be able to submit server certificates for your Exchange 2010 environment, bear in mind that you will need deploy an installation of your Root CA certificates in your machines in order to trust and avoid the certificate pop up message,

Once you have your PKI infrastructure created (one Enterprise CA is enough), go to your CAS server

[PS] C:\>Set-Content -path "C:\Cert\cert.req" -Value $Data[PS] C:\>$data=New-ExchangeCertificate -GenerateRequest -SubjectName "c=CA,o=Company," -DomainName we,,,, CAS1, -FriendlyName -privatekeyexportable:$true

Creating a new session for implicit remoting of "New-ExchangeCertificate" command...

[PS] C:\>Set-Content -path "C:\Cert\cert.req" -Value $DataWith this request you should go to your CA

Go to Request certificate and Advance and  then to the option
Submit a certificate request by using a base-64-encoded CMC or PKCS #10 file, or submit a renewal request by using a base-64-encoded PKCS #7 file.

Note: if you need subject alternative names, add in attributes box as

Submit the request and save as .cer file
In your CAS server
[PS] C:\>Import-ExchangeCertificate -FileData ([Byte[]]$(Get-Content -Path c:\cert\certnew.cer -Encoding byte -ReadCount 0))

Thumbprint Services Subject
---------- -------- -------
633CB9DE67BD2015F649323593FC95B19B1DA95D IP...., O=Company,=CA

[PS] C:\>Enable-ExchangeCertificate -services "IIS,IMAP,SMTP"cmdlet Enable-ExchangeCertificate at command pipeline position 1
Supply values for the following parameters:
Thumbprint: 633CB9DE67BD2015F649323593FC95B19B1DA95D

Overwrite the existing default SMTP certificate?

Current certificate: 'C51882DC5CE37F08B57C63BB5F1D7BDB944410A7' (expires 4/27/2015 12:32:57 PM)
Replace it with certificate: '633CB9DE67BD2015F649323593FC95B19B1DA95D' (expires 5/3/2012 6:00:34 AM)
[Y] Yes [A] Yes to All [N] No [L] No to All [?] Help (default is "Y"): L

[PS] C:\>Get-ExchangeCertificate
Thumbprint Services Subject
---------- -------- -------
633CB9DE67BD2015F649323593FC95B19B1DA95D IP.WS., O=Company, C=CA
5113A9E9CC355BB8C96C6F986269AFD1584F07C3 ...... C=CA, O=Company,
C853F48A8A9E8500C3665777A8CF79A2AF30911D ...... C=CA, O=Company,
C51882DC5CE37F08B57C63BB5F1D7BDB944410A7 .P..S. CN=CAS1

Set autodiscover service

[PS] C:\>Set-ClientAccessServer -Identity CAS1 -AutoDiscoverServiceInternalUri

Set OAB service:
[PS] C:\>$a=get-OABVirtualDirectory -Server CAS1[PS] C:\>Set-OABVirtualDirectory $a -InternalURL
[[PS] C:\>Set-OABVirtualDirectory -Identity "OAB (Default Web Site)" -RequireSSL:$true
Set Web services URL
[PS] C:\>$a=get-WebServicesvirtualdirectory -Server CAS1Creating a new session for implicit remoting of "Get-WebServicesVirtualDirectory" command...
[PS] C:\>Set-WebServicesvirtualdirectory $a -InternalURL

Set Exchange ActiveSync URL
[PS] C:\>$a=get-ActiveSyncvirtualdirectory -Server CAS1[PS] C:\>Set-ActiveSyncvirtualdirectory $a -InternalURL

You must configure that in all CAS servers in your environment , of course this depends of your environment.
Further information, I'll glad to help you


Chile te olvides !!!! DST Patch for Windows Operative Systems...

Just a reminder.. for Chile,, we are close to 2nd Saturday of March

The December DST CU contains 2011 adjusted DST start and end-dates for the following timezones:

·    Israel Standard Time
·    Morocco Standard Time
·    PacificSA Standard Time
·    Samoa Standard Time
·    Syria Standard Time

Important This update supersedes and replaces update 2158563, which was released in September 2010. This update also includes additional time zone changes made after update 2158563 was created.

If you have already deployed update 2158563, read the descriptions of the specific time zone changes that are addressed in this article to determine whether you must deploy this update immediately. If systems are not directly affected, you can schedule deployment at the next available opportunity.

We recommend that you deploy the most current Windows cumulative time zone update to guarantee the consistency of the time zone database on all systems.

  • Before you apply the update that is described in this article, be aware of potential issues that may affect Microsoft Outlook.
    For more information about these issues, click the following article number to view the article in the Microsoft Knowledge Base:
    931667  ( ) How to address time zone changes by using the Time Zone Data Update Tool for Microsoft Office Outlook
  • If you are running Microsoft Exchange Server in an Information Technology (IT) environment, you must take additional measures to guarantee the correct operation of Exchange Server.

    For more information about the Exchange daylight saving time (DST) update, click the following article number to view the article in the Microsoft Knowledge Base:
    941018  ( ) How to address daylight saving time by using the Exchange Calendar Update Tool
  • Cumulative time zone updates contain only data that has changed for a specific region or that was added to maintain parity with other operating system versions. Therefore, if a time zone key is deleted, some original values may not be restored after you apply the cumulative zone update.
    We do not recommend that you delete any registry keys that are related to time zones. On a computer that has incomplete time zone keys, first restore the time zone keys from a known good backup. Then, apply the update.

Gracias amigos chilenos!!


Error: “Couldn’t find the Enterprise Organization Container” when Creating a New Mailbox Export Request

Hi all,
this is a new cmdlet from Exchange 2010 Sp1, that allow you to create a PST from an active mailbox. First of all you must create a share folder with the below permissions at NTFS and Share level for the Exchange Trusted Subsystem group

After that be sure if your account has the necessary permissions or create a New role for that

Add your user to this role

run the command

Further information see



Thursday, February 17, 2011

How to export a PST file in Exchange 2010 and Tivoli Data Protection Client..this will make you forget the Exmerge tool :)

Do not tell me you miss the exmerge all miss him.... So I'm glad to show and share this solution:

Pre-requisites: (all must be installed in your Mailbox server)
  1. TDP for  Microsoft Exchange client version 6.1.3
  2. TSM BA Client  version 6.2.2
  3. Update Rollup 2 for Exchange Server 2010 Service Pack 1
  4. Microsoft Exchange Server MAPI Client and Collaboration Data Objects 1.2.1
    5.  A Recovery Database doesn't exists
Check the Tivoli for Mail documentation :

Configure in your TDP client the DBTemp and LOGTemp directory and the CAS server (only available in the 6.1.3 version)

When you run the below command  a new Recovery Database will be created in the local mailbox server, you must provides the user name's alias to recover and the date. If you want to recover a mailbox user from another server that local you must add the /EXCSERVER switch in the command. Then the application will search the user in the catalog and the backup more closely to the date you 've indicated before. After that the application will creates the Recovery Database in your server dismounted and start the restore.
Very important take in care the permissions, be sure that the account is member of Organization Management Role and add the send as and full access permission

Add-MailboxPermission -Identity 'CN=User1,CN=Users,DC=test,DC=ca' -User 'TEST\restoreadmin' -AccessRights 'FullAccess'
Add-ADPermission -Identity 'CN=User1,CN=Users,DC=test,DC=ca' -User 'TEST\restoreadmin' -ExtendedRights 'Send-as'

From "your_installation_path\Tivoli\TSM\TDPExchange\" open the Exchange Client - Command Line and type:


and this is the output

IBM Tivoli Storage Manager for Mail:
Data Protection for Microsoft Exchange Server
Version 6, Release 1, Level 3.01
(C) Copyright IBM Corporation 1998, 2010. All rights reserved.

Starting Microsoft Exchange restore...
Querying Exchange component information...
Querying mailbox information...
Connecting to TSM Server as node 'MBX1T1_EXC'...
Connecting to Local DSM Agent 'MBX1T1'...
Preparing Exchange Recovery Database...
Performing mailbox restore using closest available backup.
Connecting to TSM Server as node 'MBX1T1_EXC'...
Connecting to Local DSM Agent 'MBX1T1'...
Starting Microsoft Exchange restore...

Beginning VSS restore of 'Logs', 'MST1DB1'...

Preparing for restore of 'MST1DB1' from TSM backup.
   Files Examined/Completed/Failed: [ 3504 / 3504 / 0 ]   Total Bytes: 3966952400
VSS Restore operation completed with rc = 0
   Files Examined   : 3504
   Files Completed  : 3504
   Files Failed     : 0
   Total Bytes      : 3966952400

Querying Exchange Recovery Database...
Checking Active Directory entries...
Recovering deleted items for mailbox 'User1(user1)'. This process may take several minutes...

Restoring mailbox 'User1(user1)' to 'e:\pst\user1.pst'...

  Mailbox restore completed successfully with 59 items restored.
Removing Exchange Recovery Database...

Total mailboxes requested for restore:     1
Total mailboxes restored:                  1

And that's it...but we have several troubles and a lot of drops of transpiration poured...

1. This is because the CAS server wasn't set in the configuration.
02/17/2011 08:00:48 ANS0322E (RC5853) no text available for this return code.
02/17/2011 08:00:48 ANS0322E (RC5853) no text available for this return code.
02/17/2011 08:00:50 The operation couldn't be performed because object 'MBX1T1' couldn't be found on ''.
02/17/2011 08:00:50 =========================================================================
02/17/2011 08:00:50 Request                                 : Restore Mailbox Results       
02/17/2011 08:00:50 -------------------------------------------------------------------------
02/17/2011 08:00:50 Total mailboxes requested for restore   : 1                          
02/17/2011 08:00:50 Total mailboxes restored                : 0                          
02/17/2011 08:00:50 -------------------------------------------------------------------------
02/17/2011 08:00:50 ANS0322E (RC5853) no text available for this return code.
02/17/2011 08:29:50 =========================================================================

2. This is because the TDP client version should be 6.1.3

2/17/2011 05:41:16 ============================================================
02/17/2011 05:41:16 Request                           : VSS RESTORE
02/17/2011 05:41:16 Component List                    : 'Logs'(full, TSM), 'MST1DB1'(full, TSM)
02/17/2011 05:41:16 Local DSMAGENT Node               : MBX1T1
02/17/2011 05:41:16 Mount Wait                        : Yes
02/17/2011 05:41:16 ------------------------------------------------------------
02/17/2011 05:41:51 Backup(s) to be restored:
02/17/2011 05:41:51 <Logs : VSS : full : 02/16/2011 11:34:46>
02/17/2011 05:41:51 <File : VSS : full : 02/16/2011 11:34:46>
02/17/2011 05:42:02 Preparing for restore of 'MST1DB1' from TSM backup.
02/17/2011 05:59:29 VSS Restore operation completed with rc = 0
02/17/2011 05:59:29    Files Examined   : 3504
02/17/2011 05:59:29    Files Completed  : 3504
02/17/2011 05:59:29    Files Failed     : 0
02/17/2011 05:59:29    Total Bytes      : 3966952400
02/17/2011 06:00:08 ACN5909E The MAPI subsystem logon has failed. Please check that you have
02/17/2011 06:00:08 an active mailbox and sufficient privileges for this operation.

02/17/2011 06:00:11 =========================================================================
02/17/2011 06:00:11 Request                                 : Restore Mailbox Results       
02/17/2011 06:00:11 -------------------------------------------------------------------------
02/17/2011 06:00:11 Total mailboxes requested for restore   : 1                          
02/17/2011 06:00:11 Total mailboxes restored                : 0                          
02/17/2011 06:00:11 -------------------------------------------------------------------------

 Be happy delegating this task to the Backup Team :)

Thank you JuanMa!!

Monday, February 14, 2011

Users are getting “Security certificate on server is not valid” error message when trying to access emails from their mobile devices ...And you just recently has renewed the CAS & ISA 's Verisign certifcates

UPDATED 02/15/2011

I know I not new, ours Verisign friends have published new Intermediate certificates, so all new or renewed certificates requested at (10/30/2010)  with all possible path set, will need to update or install this Intermediate certificate in the servers, in mobile devices and clients machines as well..

SSL/TLS certificates issued by VeriSign after Oct 10th 2010 will use a trust chain that includes the new intermediate certificates. You may need to import these certificates into CAS and ISA Server to support TLS with partners.
If you use VeriSign for your TLS certificates, I believe you need to import these new intermediate certificates before importing any newly requested VeriSign TLS certificate
See the link

If you enrolled for your certificate between May 17, 2009 and October 10th, 2010 Click here for your Intermediate CA

If you enrolled for your certificate before May 17, 2009
Click here for your Intermediate CA

Download the root CA for Windows XP SP3

Please follow this link for how to install this certificate in Windows Server environments



"The name of the security certificate is invalid or does not match the name of the site" when check Free/Busy calendar availability or OOF message

OOF and Free/Busy calendar availability depends on Autodiscovery Service.

First of all to get this availability for Outlook anywhere the /Autodiscover folder should be published form ISA server , and configuring the External URL in CAS servers.

Enable-OutlookAnywhere -Server CAS01 -ExternalHostname "" -ExternalAuthenticationMethod "Basic" -SSLOffloading:$False

Set-OABVirtualDirectory -identity "CAS01\OAB (Default Web Site)" -externalurl -RequireSSL:$true

Set-WebServicesVirtualDirectory -identity "CAS01\EWS (Default Web Site)" -externalurl -BasicAuthentication:$True

Windows 2008 R2 Sp1 and Exchange

Good mooooornig Buenos Aires...and wherever you are...
The Windows Team Announcing Availability of Windows 7 and Windows Server 2008 R2 SP1, and what about our exchange servers???
The Exchange Team says yes!..please check below :
( see

We wanted to let you know that we've completed testing with Windows 2008 R2 SP1 and the following versions of Exchange are supported to run on Windows 2008 R2 SP1 (the RTM version of SP1):
  • Exchange 2010 SP1
  • Exchange 2010 RTM
  • Exchange 2007 SP3
Please note that Exchange 2007 was not supported to run on Windows 2008 R2 at all before Exchange 2007 SP3 release.
Also note, Windows 2008 R2 SP1 includes the hotfixes required to install Exchange 2010 SP1 (listed in Exchange 2010 SP1 FAQ and Known Issues — 979744, 983440, 979099, 982867 and 977020). If you're installing Exchange 2010 SP1 on a server running Windows 2008 R2 SP1, you don't need to install these hotfixes separately.


Friday, February 11, 2011

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

UPDATED 17/02/2011
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!
  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


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.
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...


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"

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"

foreach ($u in $script)


$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) {
               if ($2k3.LogonTime -ne $null) {

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

###### end code

Client Mode:



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:



Wednesday, February 9, 2011

Outlook 2003 Free/Busy issues in Exchange 2010 environmet

Hello everyone,

below is an extract from a great article

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 2007
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"
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"

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
An error occurs when an Exchange server 2003 user tries to open more than one delegate mailboxes of Exchange Server 2010 in Outlook 2003


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

Signature= "$Windows NT$"
Subject= "CN;OU=MyCompany IT;O=My Company Inc;L=Saavedra;S=CABA;C=AR"
KeySpec = 1 
KeyLength = 1024  
Exportable = TRUE
MachineKeySet = TRUE
PrivateKeyArchive = FALSE
UserProtected = FALSE   
UseExistingKeySet = FALSE
ProviderName = "Microsoft RSA Schannel Cryptographic Provider"
ProviderType = 12
RequestType = PKCS10 
KeyUsage = 0xa0   

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


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).

For more information about using the certificate tasks, see the Exchange 2007 Online Help topic Creating a Certificate or Certificate Request for TLS .
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, 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>” -DomainName =<Primary Namespace>, <Secondary Namespace(s)>, <ServerName>, <ServerName>, <Location Code> -FriendlyName <Primary Regional Namespace> -privatekeyexportable:$true -path c:\cert.txt

An example of [Full Subject Path] is "c=US, o=Company,".

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.
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


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 tough


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)

  • 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 :

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" />

Move! Move! Move!! Thanks Andy!!


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

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

DataBase's OnLine Defrag is silent as bad cholesterol - Exchange 2007

And is true...Before you know it, you have clogged arteries..and your databases ..broken .So the code below will check the events 700-701-702-703-704 see the table below.

As Microsoft states as best practices :
"Monitoring online defragmentation enables you to verify that defragmentation of every Exchange database is completing often enough (at least every two weeks, as a best practice). Monitoring online defragmentation may also enable you to decrease the online maintenance window, which has the following advantages:
  • Allows more time for database backup.
  • Validates that online checksumming and page zeroing can be introduced within the current online maintenance window.
Microsoft Exchange Server 2007 Service Pack 1 (SP1) introduces the following improvements to help you monitor online defragmentation:
  • Extended information for Event 703 allows you to more easily monitor online defragmentation pass completions.
  • Two extended Extensible Storage Engine (ESE) performance counters for monitoring the effectiveness and efficiency of online defragmentation have been added for use with Performance Monitor (which is called Reliability and Performance Monitor in Windows Server 2008)."
This code will generate two types fo outputs:

With errors (not completed)
Name                    : DATABASE1-SG04
Identity                : SERVER\STORAGEGROUP\DATABASE1-SG04
EdbFilePath             : N:\STORAGEGROUP\DATABASE1-SG04
DefragStart             :
DefragEnd               :
DefragDuration          :
DefragInvocations       :
DefragDays              :
DefragInterrupts        :
DefragError             : unexpected error :-327.--> this is a critical error, you shold repair the DB ( : 20/01/2011
DefragStillRunningDays  : 13  ----> 13 days running

Without errors (completed)
Name                    : DATABASE-SG05
Identity                : SERVER\STORAGEGROUP\DATABASE-SG05
EdbFilePath             : P:\DATABASE\DATABASE-SG05.edb
DefragStart             : 03/02/2011 04:54 
DefragEnd               : 03/02/2011 04:54
DefragDuration          : 28976 seconds.
DefragInvocations       : 2 time[s].
DefragDays              : 1
DefragInterrupts        : 03/02/2011 09:59  ---> Backup interruptions
DefragError             :
DefragStillRunningSince :
DefragStillRunningDays  :

The event 705 is preceded for the event 447 , this issue indicates that a corrupt page link was detected in a B-Tree.

Online defragmentation has failed because of some issues in this tree. Event 447 suggests that a B-tree consists a corrupt page link. The most common reasons for this problem to occur are:

Note: It is not safe to continue using such corrupted database as a bad page link indicates logical database corruption at ESE level. Also, you should ensure that no antivirus software is scanning the Exchange database files.

    • Check the Application log carefully for related events and patterns that may relate to this event. Check the System log carefully for related events and patterns including any errors related to hardware, drives, controllers, or the file system. If there are any such errors, replace the hardware, update the hardware system files, or repair the file system to prevent any future errors. Do this before proceeding to the next step
    • If the Exchange store database is running, use ExMerge to merge your data to .pst files, delete the database, create a blank database, and then run ExMerge t databases to a blank database.
    • If the database is running, you may also move all the mailboxes to another store, delete the affected database, create a new database, and then move all the mailboxes back.
    • If the Exchange store database will not mount, the suggested remedy is to restore from online backup before the errors appear in the Application log.
    • If the Exchange store database will not mount and there is no backup, the last resort is to repair the database by running eseutil /p and then repeatedly running isinteg -fix until there are no fixes reported. Finally, run ExMerge, create a blank store, and use ExMerge to move the data back in.
-----------------------begin code
$srv = Get-ExchangeServer |where {$_.IsMailboxServer -eq 'True'}

$output = @()
$dmtf = [System.Management.ManagementDateTimeconverter]
$Startdate = $dmtf::ToDmtfDateTime( (Get-Date).AddDays(-1).Date )
$free = @{Name="WhiteSpace(MB)";Expression={[int]$_.InsertionStrings[0]}}

foreach ($dbserver in $srv){

# Get the mailbox databases from the server
$mbdatabases = Get-MailboxDatabase -Server $ | Sort-Object -Property Name

# Get the public folder databases from the server
$pfdatabases = Get-PublicFolderDatabase -Server $ | Sort-Object -Property Name

# Create an array for the databases
$databases = @()

# Check if mailbox databases were found on the server
If ($mbdatabases) {
      # Loop through the databases
      ForEach ($mdb in $mbdatabases) {
            # Create an object to store information about the database
            $db = "" | Select-Object Name,Identity,EdbFilePath,DefragStart,DefragEnd,DefragDuration,DefragInvocations,DefragDays,DefragInterrupts,DefragError,DefragStillRunningSince,DefragStillRunningDays
            # Populate the object
            $db.Name = $mdb.Name.ToString()
            $db.Identity = $mdb.Identity.ToString()
            $db.EdbFilePath = $mdb.EdbFilePath.ToString()
            # Add this database to the array
            $databases = $databases + $db

# Check if public folder databases were found on the server
If ($pfdatabases) {
      # Loop through the databases
      ForEach ($pfdb in $pfdatabases) {
            # Create an object to store information about the database
            $db = "" | Select-Object Name,Identity,EdbFilePath,DefragStart,DefragEnd, DefragDuration,DefragInvocations,DefragDays,DefragInterrupts,DefragError,DefragStillRunningSince,DefragStillRunningDays
            # Populate the object
            $db.Name = $pfdb.Name.ToString()
            $db.Identity = $pfdb.Identity.ToString()
            $db.EdbFilePath = $pfdb.EdbFilePath.ToString()
            # Add this database to the array
            $databases = $databases + $db

# Retrieve the events from the local Application log, filter them for ESE messages
$logs = Get-WMIObject Win32_NTLogEvent -ComputerName $  -Filter "LogFile='Application' AND Timewritten>='$startdate' AND sourceName='ESE' AND CategoryString='Online Defragmentation'  "

# Loop through each of the databases and search the event logs for relevant messages
ForEach ($db in $databases) {

      # Create the search string to look for in the Message property of each log entry
      $s = "*" + $db.EdbFilePath + "*"

      # Search for an event 701 or 703, meaning that online defragmentation finished
      $end = $logs | where {
            $_.Message -like "$s" -and ($_.eventcode -eq 701 -or $_.eventcode -eq 703)
      } | select-object -First 1

      # Search for the first event 700 which preceeds the finished event
      $start = $logs | where {
            $_.Message -like "$s" -and $_.eventcode -eq 700 -and $_.Index -le $end.Index
      } | select-object -First 1
  $interr = $logs | where {
            $_.Message -like "$s" -and $_.eventcode -eq 704
      } | select-object -First 1
 $defError = $logs | where {
            $_.Message -like "$s" -and $_.eventcode -eq 705
      } | select-object -First 1

 $defStillRun = $logs | where {

            $_.Message -like "$s" -and $_.eventcode -eq 702
      } | select-object -First 1

      # Make sure we found both a start and an end message
      if ($start -and $end  ) {

            # Get the start and end times
  $st= $start.TimeGenerated

  $et= $end.TimeGenerated


           $db.DefragStart = $stD + "/" + $stM + "/" +  $stY + " " + $stH + ":"  + $stMs
            $db.DefragEnd = $etD  + "/" + $etM + "/" + $etY  + " " + $etH + ":" + $etMs

            # Parse the end event message for the number of seconds defragmentation ran for
            $end.Message -match "This pass started on .* and ran for a total of .* seconds" >$null
     #$db.DefragStart = $Matches[0].Split(" ")[4] + " restarted."
            $db.DefragDuration = $Matches[0].Split(" ")[11] + " seconds."

            # Parse the end event message for the number of invocations and days
            $end.Message -match "requiring .* invocations over .* days" > $null
            $db.DefragInvocations = $Matches[0].Split(" ")[1] + " time[s]."
            $db.DefragDays = $Matches[0].Split(" ")[4]

  #$interr.Message -match "was interrupted and terminated." >$null
  if ($interr) {
  $it= [string]$interr.TimeGenerated
       $db.DefragInterrupts=$itD  + "/" + $itM + "/" + $itY  + " " + $itH + ":" + $itMs
          } else {

            if ($defError -and $defStillRun) {

            $defError.Message -match "after encountering unexpected error .*" >$null
            $db.DefragError = "unexpected error :" + $Matches[0].Split(" ")[4]

     $defStillRun.Message -match "pass started on .* and has been running for .* days" >$null 
     $db.DefragStillRunningSince = $Matches[0].Split(" ")[3]
     $db.DefragStillRunningDays = $Matches[0].Split(" ")[9]

      # Add the data for this database to the output
      $output = $output + $db
# Print the output

------end code

Don't happy.