List DPM Backups

I was asked to create a list of what we are backing up with DPM, including the schedule and frequency. I looked around and came up with a couple approaches:

List data sources DPM is protecting:


Get-DPMDataSource | where {$_.Protected -eq "True"}

Results:

Computer Name   ObjectType
-------- ----   ----------
SERVER01 model  SQL Server 2016 database
SERVER01 master SQL Server 2016 database
SERVER01 msdb   SQL Server 2016 database

The results could be sorted and exported to CSV:


Get-DPMDataSource | where {$_.Protected -eq "True"} | Sort-Object Computer,Name | export-csv dpmdatasource.csv

List all previous jobs that ran against the data sources:


Get-DPMJob | select ProtectionGroupName, DataSources, Status, StartTime, EndTime, DataSize | Sort-Object ProtectionGroupName, DataSources

Results:

ProtectionGroupName DataSources    Status    StartTime           EndTime             DataSize
SQL Servers         SERVER01\model Succeeded 04/12/2016 10:11:21 04/12/2016 10:13:06 328893

Put it all together adding Get-RecoveryPoint:


$PGroup = Get-DPMProtectionGroup
ForEach ($PG in $PGroup) { 
 $DS=Get-DPMDataSource -ProtectionGroup $PG | where {$_.Protected -eq "True"}
 ForEach ($DataSource in $DS) {
 $RP=Get-RecoveryPoint -Datasource $DataSource | Sort-Object BackupTime -Descending
 $CompareDate=Get-date($RP[0].BackupTime) -format g
 If ($RP.count -gt 0) {
 Write-Host $PG.Name,',',$PG.ProtectionMethod,',',$CompareDate,',', $DataSource.Computer,',', $DataSource.Name,',', $DataSource.ObjectType,',', $DataSource
 } ElseIf ($RP.count -eq 0) {
 Write-Host "Error: No RecoveryPoint for $DataSource" -ForegroundColor Red
 }
}
}
Results:

JobCreationDateTime Computer Device Type                     JobRecoveryPointName
04/12/2016 10:11:21 SERVER01 master SQL Server 2016 database SERVER01\model on computer SERVER01

Leave a Reply