By design, DPM 2007 should be ‘fire and forget’ – meaning that after initial replication, data changes will automatically and routinely replicate.
However, due to a variety of external factors, the data set may become inconsistent. Usually, DPM will correct itself within a replication cycle. Depending on how often you have configured replication, this may not be soon enough. One resolution to this is to have one’s management solution (e.g. System Center Operations Manager) see the alert that a data set is inconsistent and then automatically run this ‘consistency check’ to revalidate the data in a more timely manner.
Attached is a sample PowerShell script to invoke a consistency check of on a DPM data source.
# This script do a consistency check on the file system data source. The parameters have to be initialized first as given below. Please give the values of parameters as appropriate for your environment. You can customize this easily as per your needs. Save the attached file as a .ps1 file and invoke through the DPM Management Shell.
$dpmname = "DPM Server Name";
$pgname = "My PG";
$dsname = "G:\";function StartDatasourceConsistencyCheck
{
param($dpmname, $pgname, $dsname, $isheavyweight)write-host "Start consistency check on $dsname "
trap{"Error in execution... $_";break}
&{
write-host "Getting protection group $pgname in $dpmname..."
$clipg = Get-ProtectionGroup $dpmname | where { $_.FriendlyName -eq $pgname }if($clipg -eq $abc)
{
Throw "No PG found"
}write-host "Getting $dsname from PG $pgname..."
$ds = Get-Datasource $clipg | where { $_.logicalpath -eq $dsname }if($ds -eq $abc)
{
Throw "No Data Source found"
}if( $isheavyweight -ne "true")
{
write-host "Starting light weight consistency check..."
$j = Start-DatasourceConsistencyCheck -Datasource $ds
$jobtype = $j.jobtype
if(("Validation") -notcontains $jobtype)
{
Throw "Shadow Copy job not triggered"
}
while (! $j.hascompleted ){ write-host "Waiting for $jobtype job to complete..."; start-sleep 5}
if($j.Status -ne "Succeeded") {write-host "Job $jobtype failed..." }
Write-host "$jobtype job completed..."
}
else
{
write-host "Starting Heavy weight consistency check..."
$j = Start-DatasourceConsistencyCheck -Datasource $ds -HeavyWeight
$jobtype = $j.jobtype
if(("Validation") -notcontains $jobtype)
{
Throw "Shadow Copy job not triggered"
}
while (! $j.hascompleted ){ write-host "Waiting for $jobtype job to complete..."; start-sleep 5}
if($j.Status -ne "Succeeded") {write-host "Job $jobtype failed..." }
Write-host "$jobtype job completed..."
}}
}#Example for usage
StartDatasourceConsistencyCheck $dpmname $pgname $dsname "false"
StartDatasourceConsistencyCheck $dpmname $pgname $dsname "true"