CLI: Create new Recovery points on tape for all datasources in a PG

Published Feb 14 2019 08:06 PM 44 Views
First published on TECHNET on Jan 14, 2008

This is a sample script that will automatically create new recovery points for the entire Data source’s in a Protection Group. You can customize this easily to change script file to create recovery points on disk. Save the attached file as a .ps1 file and invoke through the DPM Management Shell.

--------------------- Start of Script ---------------------

param([string] $dpmname, [string] $pgname, [string] $backupoption)

if(!$dpmname)
{
$dpmname = read-host "DPMName:"
}
if(!$pgname)
{
$pgname =  read-host "pgName:"
}
if(!$backupoption)
{
$backupoption =  read-host "BackOption:"
}


write-Output "Creating $backupoption Recovery Point"

trap{"Error in execution... $_";break}
&{
write-Output "Getting protection group $pgname in $dpmname..."
$clipg = Get-ProtectionGroup $dpmname | where { $_.FriendlyName -eq $pgname}

if($clipg -eq $abc)
{
Throw "No PG found"
}

write-Output "Getting DS from PG $pgname..."
$backupds = @(Get-Datasource $clipg)

foreach ($ds in $backupds)
{
write-Output "Creating Recovery point for $ds..."
$j = New-RecoveryPoint -Datasource $ds -Tape -ProtectionType $backupoption
$jobtype = $j.jobtype
Write-Output "$jobtype Job has been triggerred..."
}



}

--------------------- End of Script ------------------------

- Mukul Singh Shekhawat


Version history
Last update:
‎Mar 11 2019 07:59 AM
Updated by: