We are preparing the backup report and we are unable to fetch the oldest recovery point time.

Alwyn Gonsalves 20 Reputation points
2024-07-03T09:32:08.3266667+00:00

We are able to fetch latest recovery point time. But when we try to fetch the oldest its not possible. We are using Get-AzRecoveryServicesBackupRecoveryPoint to fetch the recovery point. We are able to fecth only 7 days time diffrece data. How can we fetch oldest recovery point data using powershell.

Azure Backup
Azure Backup
An Azure backup service that provides built-in management at scale.
1,281 questions
0 comments No comments
{count} votes

Accepted answer
  1. SadiqhAhmed-MSFT 46,036 Reputation points Microsoft Employee
    2024-07-03T14:29:46.5633333+00:00

    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


1 additional answer

Sort by: Most helpful
  1. Deleted

    This answer has been deleted due to a violation of our Code of Conduct. The answer was manually reported or identified through automated detection before action was taken. Please refer to our Code of Conduct for more information.


    Comments have been turned off. Learn more

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.