Hello @Alwyn Gonsalves Thank you for contacting us through Microsoft Q&A platform. Happy to assist you with your concern.
By default, the Get-AzRecoveryServicesBackupRecoveryPoint
cmdlet retrieves the recovery points for the last 7 days. To retrieve older recovery points, you need to specify the StartDateTime
and EndDateTime
parameters to define the time range for the recovery points you want to retrieve.
Here's an example PowerShell script that retrieves the oldest recovery point for a specified item:
$resourceGroupName = "MyResourceGroup"
$vaultName = "MyRecoveryServicesVault"
$itemName = "MyItem"
$containerName = "MyContainer"
Get the backup item
$backupItem = Get-AzRecoveryServicesBackupItem -ResourceGroupName $resourceGroupName -VaultName $vaultName -Name $itemName -ContainerName $containerName
Get the oldest recovery point
$recoveryPoints = Get-AzRecoveryServicesBackupRecoveryPoint -Item $backupItem -StartDate (Get-Date).AddDays(-30) -EndDate (Get-Date) $oldestRecoveryPoint = $recoveryPoints | Sort-Object RecoveryPointTime | Select-Object -First 1
Display the oldest recovery point
Write-Host "Oldest recovery point time: $($oldestRecoveryPoint.RecoveryPointTime)"
In this example, the Get-AzRecoveryServicesBackupRecoveryPoint
cmdlet is used to retrieve the recovery points for the last 30 days by specifying the StartDate
and EndDate
parameters. The recovery points are then sorted by the RecoveryPointTime
property and the oldest recovery point is selected using the Select-Object
cmdlet.
You can modify the StartDate
and EndDate
parameters to retrieve recovery points for a different time range as needed.
Hope this helps. Let us know if you have any further questions or concerns.
If the response helped, do "Accept Answer" and up-vote it