Backing up DAG cluster with TSM

There is a problem with DAG cluster backup in TSM. When you create script with /PREFERDAGPASSIVE key, your script return error 464 – nothing to backup. So I’ve created script to analyze Exchange’s databases if there is healthy passive copy of database to backup, so you run backup for the only healthy copy of database and for passive healthy copies of database. If there is nothing to backup than script returns 0.

$exc_dir=”C:\Program Files\Tivoli\TSM\TDPExchange”
cd $exc_dir
Get-Date -UFormat %Y-%m-%d’ ‘%T | Out-File -Encoding utf8 -FilePath excfull.log -Append
add-pssnapin Microsoft.Exchange.Management.PowerShell.E2010
foreach ($maildatabase in Get-MailboxDatabase -Server $env:COMPUTERNAME)
{
$copies=0;
$needtobackup=$False;
foreach($dbcopy in Get-MailboxDatabaseCopyStatus $maildatabase)
{
if(($dbcopy.Status -eq “Mounted”) -or ($dbcopy.Status -eq “Healthy”))
{
$copies+=1
}
if((!$dbcopy.ActiveCopy) -and ($dbcopy.MailboxServer -eq $env:COMPUTERNAME))
{
$needtobackup=$True
}
}
if($copies -lt 2)
{
$needtobackup=$True
}
}

if($needtobackup)
{
.\tdpexcc.exe backup * full /PREFERDAGPASSIVE /tsmoptfile=dsm.opt /CONFIGfile=tdpexc.cfg /logfile=excsch.log | Out-File -Encoding utf8 -FilePath excfull.log -Append
$backupresult = $LASTEXITCODE
“Return code was $backupresult” | Out-File -Encoding utf8 -FilePath excfull.log -Append
}else{
“Nothing to backup” | Out-File -Encoding utf8 -FilePath excfull.log -Append
$backupresult=0
“Return code was $backupresult” | Out-File -Encoding utf8 -FilePath excfull.log -Append
}
exit $backupresult

 

2 Replies to “Backing up DAG cluster with TSM”

  1. Hi, I am also experiencing what IBM refers to as “working as designed”…Error 464 in a DAG.

    I’d like to know how to integrate your script to our environment. I am currently using a .cmd file to backup Exchange DBs in a DAG as per the default in the TDP for Exchange. However, this script contains Powershell. Can TSM Server call a ps1 instead of a .cmd for backup?

    If not, can you tell me how to do it with a little bit more details. It would be greatly appreciated! Thanks in advance!

    Benoit.

  2. Hello. Just create cmd file containg:
    powershell -NoProfile c:\PATH_To_your_script\ExchangeBackup.ps1
    and point your schedule to this cmd file.

Leave a Reply