Fixing Failed and Suspended DB copies

*N.B. this is an old article and may no longer be relevant*

I was looking for something in my archive e-mail and stumbled across this script for Exchange 2010.

One of the things I have observed is that database copies easily fail if you have repeated failovers and switchovers with little or no traffic. As what happens when you are testing a new environment.

http://www.cohesivelogic.com/2010/08/automatically-fixing-failedandsuspended-exchange-2010-databases-with-powershell/

It's not one of my scripts, so I'm not taking credit for it.

Here is the script listed in the article:



add-pssnapin *0* -ErrorAction SilentlyContinue
$startstring="Start script run at:  "
$startendtime=date
$startannounce=$startstring+$startendtime
Start-Transcript -Append -Force -Path 'C:\<path>\DBHealthFix.log'
$startannounce
#gets list of mailboxservers, locates 2010 servers, gets db copy status, finds copies that are failed, updates failed copies
$mailboxservers = get-mailboxserver | get-exchangeserver | ?{$_.IsE14OrLater -eq 'True'}
foreach ($mailboxserver in $mailboxservers){
get-mailboxdatabasecopystatus -Server $mailboxserver.name | ?{$_.Status -like 'FailedAndSuspended'} | update-mailboxdatabasecopy -deleteexistingfiles -confirm:$false
}
stop-transcript

I don't know any rocket scientists, which is okay because it doesn't need one to work out that you need to replace "<path>" in the script with an appropriate folder name.