{"id":7502,"date":"2023-11-26T23:34:29","date_gmt":"2023-11-26T23:34:29","guid":{"rendered":"https:\/\/pariswells.com\/blog\/?p=7502"},"modified":"2023-11-26T23:34:31","modified_gmt":"2023-11-26T23:34:31","slug":"powershell-script-dpm-microsoft-azure-backup-server-console-to-remove-all-the-cloud-recovery-points","status":"publish","type":"post","link":"https:\/\/pariswells.com\/blog\/research\/powershell-script-dpm-microsoft-azure-backup-server-console-to-remove-all-the-cloud-recovery-points","title":{"rendered":"Powershell Script DPM ( Microsoft Azure Backup Server )\u00a0console to\u00a0remove\u00a0all the Cloud\u00a0recovery points"},"content":{"rendered":"\n<pre class=\"wp-block-code\"><code class=\"\">param([string] $dpmname, [int32] $days )\r\n\r\nfunction Usage()\r\n{\r\nwrite-host\r\nwrite-host \"Usage::\"\r\nwrite-host \"RemoveRecoveryPoints.ps1 \"DPMServername\" Days(In int)\"\r\nwrite-host\r\n\r\n}\r\n\r\nif((\"-?\",\"-help\") -contains $args[0])\r\n{\r\nUsage\r\nexit 0\r\n}\r\n\r\n\r\n\r\nif(!$dpmname)\r\n{\r\n$dpmname = read-host \"DPMServerName:\"\r\n}\r\n\r\nif(!$days)\r\n{\r\n$days = read-host \"Number of Days\"\r\n}\r\n\r\n\r\n\r\n$pgList = Get-ProtectionGroup $dpmname\r\n\r\nForeach($pg in $pgList)\r\n{\r\n$Name = $pg.FriendlyName\r\nWrite-Host \"Getting Data Source list for PG $Name...\"\r\n$dsList = Get-Datasource $pg\r\n\r\nForeach($ds in $dsList)\r\n{\r\n$Name = $ds.Name\r\nWrite-Host \"Getting Recovery point list for Data-Source $Name ...\"\r\n$rpList = Get-RecoveryPoint $ds\r\n\r\nForeach($rp in $rpList)\r\n{\r\n\r\n$date = Get-Date\r\n$datediff = $date - $rp.RepresentedPointInTime\r\n$rpDays = $datediff.Days\r\nWrite-Host \"Recovery Point is $rpDays days old \"\r\nif($rpDays -ge $days)\r\n{\r\nWrite-Host \"Removing Recovery Point older than $rpDays\"\r\nRemove-RecoveryPoint -RecoveryPoint $rp\r\n\r\n}\r\n}\r\n}\r\n\r\n}\r\n<\/code><\/pre>\n","protected":false},"excerpt":{"rendered":"","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"class_list":["post-7502","post","type-post","status-publish","format-standard","hentry","category-research"],"aioseo_notices":[],"_links":{"self":[{"href":"https:\/\/pariswells.com\/blog\/wp-json\/wp\/v2\/posts\/7502","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/pariswells.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/pariswells.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/pariswells.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/pariswells.com\/blog\/wp-json\/wp\/v2\/comments?post=7502"}],"version-history":[{"count":1,"href":"https:\/\/pariswells.com\/blog\/wp-json\/wp\/v2\/posts\/7502\/revisions"}],"predecessor-version":[{"id":7503,"href":"https:\/\/pariswells.com\/blog\/wp-json\/wp\/v2\/posts\/7502\/revisions\/7503"}],"wp:attachment":[{"href":"https:\/\/pariswells.com\/blog\/wp-json\/wp\/v2\/media?parent=7502"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/pariswells.com\/blog\/wp-json\/wp\/v2\/categories?post=7502"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/pariswells.com\/blog\/wp-json\/wp\/v2\/tags?post=7502"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}