Discussion:
PS to remove a specific recovery point
(too old to reply)
OwenC
2008-03-05 23:51:04 UTC
Permalink
I want to manage the deletion of recovery points using a script. I see an
example of how I can use the following PS script to remove all recovery
points but I have been unable to create a filter to uniquely identify a
specific recovery point to delete.

EXAMPLE 1

$pg = Get-ProtectionGroup -DPMServerName TestingServer
$ds = Get-Datasource -ProtectionGroup $pg
$rp = Get-RecoveryPoint -Datasource $ds
Remove-RecoveryPoint -RecoveryPoint $rp

This command removes all the recovery points for a data source.

What property is used as the unique ID for a recovery point?

Owen
Vikash Jain [MSFT]
2008-03-06 05:34:17 UTC
Permalink
You can filter out recovery points which you want to remove
Say if you want to remove all disk based recovery point then you could do
something like

$rp = get-recoveryPoint -Datasource $ds
$myrp = $rp | where-object {$_.Datalocation -eq "Disk"}
remove-recoverypoint $myrp

or you can also filter based on the RepresentedPointInTime (i.e the backup
time for a recovery source)
you could filter and get all the recovery points whose
RepresentedPointInTime is less than today - 7 to get all the Point In Times
which are more than a week old

Thanks,
Vikash

This posting is provided "AS IS" with no warranties, and confers no rights.

get-recoveryPoint -Datasource $ds | where-object {
Post by OwenC
I want to manage the deletion of recovery points using a script. I see an
example of how I can use the following PS script to remove all recovery
points but I have been unable to create a filter to uniquely identify a
specific recovery point to delete.
EXAMPLE 1
$pg = Get-ProtectionGroup -DPMServerName TestingServer
$ds = Get-Datasource -ProtectionGroup $pg
$rp = Get-RecoveryPoint -Datasource $ds
Remove-RecoveryPoint -RecoveryPoint $rp
This command removes all the recovery points for a data source.
What property is used as the unique ID for a recovery point?
Owen
OwenC
2008-03-06 15:50:42 UTC
Permalink
Vikash,

Thanks for the response.

I tried creating a filter on RepresentedPointInTime but it doesn't work.
This the value that I actually want to filter on. I used a filter of
<where-object {$_.RepresentedPointInTime -eq "05/03/2008 6:00:42 PM"}>.
This time is an exact copy of what is displayed as one of the values for the
RepresentedPointInTime property.

Please post an example filter on RepresentedPointInTime so that I can see
how to implement it. I also tried using the UtcRepresentedPointInTime
property.

Owen
Post by Vikash Jain [MSFT]
You can filter out recovery points which you want to remove
Say if you want to remove all disk based recovery point then you could do
something like
$rp = get-recoveryPoint -Datasource $ds
$myrp = $rp | where-object {$_.Datalocation -eq "Disk"}
remove-recoverypoint $myrp
or you can also filter based on the RepresentedPointInTime (i.e the backup
time for a recovery source)
you could filter and get all the recovery points whose
RepresentedPointInTime is less than today - 7 to get all the Point In
Times which are more than a week old
Thanks,
Vikash
This posting is provided "AS IS" with no warranties, and confers no
rights.
get-recoveryPoint -Datasource $ds | where-object {
Post by OwenC
I want to manage the deletion of recovery points using a script. I see an
example of how I can use the following PS script to remove all recovery
points but I have been unable to create a filter to uniquely identify a
specific recovery point to delete.
EXAMPLE 1
$pg = Get-ProtectionGroup -DPMServerName TestingServer
$ds = Get-Datasource -ProtectionGroup $pg
$rp = Get-RecoveryPoint -Datasource $ds
Remove-RecoveryPoint -RecoveryPoint $rp
This command removes all the recovery points for a data source.
What property is used as the unique ID for a recovery point?
Owen
Mukul Shekhawat [MSFT]
2008-03-06 17:05:52 UTC
Permalink
Hi Owen,

Here is the complete example cmdlets for your case, these are working fine.
I have verified these on my system.

$pg = Get-ProtectionGroup -DPMServerName TestingServer
$ds = Get-Datasource -ProtectionGroup $pg
$rp = Get-RecoveryPoint -Datasource $ds | where
{$_.RepresentedPointInTime -eq "3/6/2008 10:07:27 PM"}
remove-recoverypoint $rp

make sure you are passing correct $pg and $ds here. As if your system has
more than one PG or more than one DS protected you need to filter them also.

do let me know if you require more info.

Thanks,
Mukul

This posting is provided "AS IS" with no warranties, and confers no
rights.
Post by OwenC
Vikash,
Thanks for the response.
I tried creating a filter on RepresentedPointInTime but it doesn't work.
This the value that I actually want to filter on. I used a filter of
<where-object {$_.RepresentedPointInTime -eq "05/03/2008 6:00:42 PM"}>.
This time is an exact copy of what is displayed as one of the values for
the RepresentedPointInTime property.
Please post an example filter on RepresentedPointInTime so that I can see
how to implement it. I also tried using the UtcRepresentedPointInTime
property.
Owen
Post by Vikash Jain [MSFT]
You can filter out recovery points which you want to remove
Say if you want to remove all disk based recovery point then you could do
something like
$rp = get-recoveryPoint -Datasource $ds
$myrp = $rp | where-object {$_.Datalocation -eq "Disk"}
remove-recoverypoint $myrp
or you can also filter based on the RepresentedPointInTime (i.e the
backup time for a recovery source)
you could filter and get all the recovery points whose
RepresentedPointInTime is less than today - 7 to get all the Point In
Times which are more than a week old
Thanks,
Vikash
This posting is provided "AS IS" with no warranties, and confers no
rights.
get-recoveryPoint -Datasource $ds | where-object {
Post by OwenC
I want to manage the deletion of recovery points using a script. I see
an example of how I can use the following PS script to remove all
recovery points but I have been unable to create a filter to uniquely
identify a specific recovery point to delete.
EXAMPLE 1
$pg = Get-ProtectionGroup -DPMServerName TestingServer
$ds = Get-Datasource -ProtectionGroup $pg
$rp = Get-RecoveryPoint -Datasource $ds
Remove-RecoveryPoint -RecoveryPoint $rp
This command removes all the recovery points for a data source.
What property is used as the unique ID for a recovery point?
Owen
Owen Clashing
2008-03-08 21:11:01 UTC
Permalink
Mukul,

Thanks. I was using the same filter as you were but the problem seems to be
that the leading zero that is shown with the day and month when the
RepresentedPointInTime property is displayed can't be used the property is
being used in a filter.

Here are some PS one liners relevant to this type operation:

* Display all recovery points on the server TestingServer
Get-ProtectionGroup -DPMServerName TestingServer | %{Get-Datasource
-ProtectionGroup $_} | %{Get-RecoveryPoint -Datasource $_}

* Display all recovery points on the server TestingServer for the protection
group TestProtectionGroup
Get-ProtectionGroup -DPMServerName TestingServer | where {$_.FriendlyName
-eq "TestProtectionGroup"} | %{Get-Datasource -ProtectionGroup $_} |
%{Get-RecoveryPoint -Datasource $_}

* Display only the recovery point on the server TestingServer for the
protection group TestProtectionGroup for a specific time (day and month
values can't have leading zeros)
Get-ProtectionGroup -DPMServerName TestingServer | where {$_.FriendlyName
-eq "TestProtectionGroup"} | %{Get-Datasource -ProtectionGroup $_} |
%{Get-RecoveryPoint -Datasource $_} | where {$_.RepresentedPointInTime -eq
"3/5/2008 6:00:42 PM"}

* Delete only the recovery point on the server TestingServer for the
protection group TestProtectionGroup for a specific time
Get-ProtectionGroup -DPMServerName TestingServer | where {$_.FriendlyName
-eq "TestProtectionGroup"} | %{Get-Datasource -ProtectionGroup $_} |
%{Get-RecoveryPoint -Datasource $_} | where {$_.RepresentedPointInTime -eq
"3/5/2008 6:00:42 PM"} | %{Remove-RecoveryPoint $_}
Post by Mukul Shekhawat [MSFT]
Hi Owen,
Here is the complete example cmdlets for your case, these are working fine.
I have verified these on my system.
$pg = Get-ProtectionGroup -DPMServerName TestingServer
$ds = Get-Datasource -ProtectionGroup $pg
$rp = Get-RecoveryPoint -Datasource $ds | where
{$_.RepresentedPointInTime -eq "3/6/2008 10:07:27 PM"}
remove-recoverypoint $rp
make sure you are passing correct $pg and $ds here. As if your system has
more than one PG or more than one DS protected you need to filter them also.
do let me know if you require more info.
Thanks,
Mukul
This posting is provided "AS IS" with no warranties, and confers no
rights.
Post by OwenC
Vikash,
Thanks for the response.
I tried creating a filter on RepresentedPointInTime but it doesn't work.
This the value that I actually want to filter on. I used a filter of
<where-object {$_.RepresentedPointInTime -eq "05/03/2008 6:00:42 PM"}>.
This time is an exact copy of what is displayed as one of the values for
the RepresentedPointInTime property.
Please post an example filter on RepresentedPointInTime so that I can see
how to implement it. I also tried using the UtcRepresentedPointInTime
property.
Owen
Post by Vikash Jain [MSFT]
You can filter out recovery points which you want to remove
Say if you want to remove all disk based recovery point then you could do
something like
$rp = get-recoveryPoint -Datasource $ds
$myrp = $rp | where-object {$_.Datalocation -eq "Disk"}
remove-recoverypoint $myrp
or you can also filter based on the RepresentedPointInTime (i.e the
backup time for a recovery source)
you could filter and get all the recovery points whose
RepresentedPointInTime is less than today - 7 to get all the Point In
Times which are more than a week old
Thanks,
Vikash
This posting is provided "AS IS" with no warranties, and confers no
rights.
get-recoveryPoint -Datasource $ds | where-object {
Post by OwenC
I want to manage the deletion of recovery points using a script. I see
an example of how I can use the following PS script to remove all
recovery points but I have been unable to create a filter to uniquely
identify a specific recovery point to delete.
EXAMPLE 1
$pg = Get-ProtectionGroup -DPMServerName TestingServer
$ds = Get-Datasource -ProtectionGroup $pg
$rp = Get-RecoveryPoint -Datasource $ds
Remove-RecoveryPoint -RecoveryPoint $rp
This command removes all the recovery points for a data source.
What property is used as the unique ID for a recovery point?
Owen
Serge Ayotte
2011-06-27 14:46:27 UTC
Permalink
I know I am replying to something old... I just hope you will come back soon to it...

In your onliner for deleting, the post as been trincated and missing the necessary parts for the deletion... Can you add what is missing please?

Thanks in advance

Serge
Post by OwenC
I want to manage the deletion of recovery points using a script. I see an
example of how I can use the following PS script to remove all recovery
points but I have been unable to create a filter to uniquely identify a
specific recovery point to delete.
EXAMPLE 1
$pg = Get-ProtectionGroup -DPMServerName TestingServer
$ds = Get-Datasource -ProtectionGroup $pg
$rp = Get-RecoveryPoint -Datasource $ds
Remove-RecoveryPoint -RecoveryPoint $rp
This command removes all the recovery points for a data source.
What property is used as the unique ID for a recovery point?
Owen
Post by Vikash Jain [MSFT]
You can filter out recovery points which you want to remove
Say if you want to remove all disk based recovery point then you could do
something like
$rp = get-recoveryPoint -Datasource $ds
$myrp = $rp | where-object {$_.Datalocation -eq "Disk"}
remove-recoverypoint $myrp
or you can also filter based on the RepresentedPointInTime (i.e the backup
time for a recovery source)
you could filter and get all the recovery points whose
RepresentedPointInTime is less than today - 7 to get all the Point In Times
which are more than a week old
Thanks,
Vikash
This posting is provided "AS IS" with no warranties, and confers no rights.
get-recoveryPoint -Datasource $ds | where-object {
Post by OwenC
Vikash,
Thanks for the response.
I tried creating a filter on RepresentedPointInTime but it doesn't work.
This the value that I actually want to filter on. I used a filter of
<where-object {$_.RepresentedPointInTime -eq "05/03/2008 6:00:42 PM"}>.
This time is an exact copy of what is displayed as one of the values for the
RepresentedPointInTime property.
Please post an example filter on RepresentedPointInTime so that I can see
how to implement it. I also tried using the UtcRepresentedPointInTime
property.
Owen
Post by Mukul Shekhawat [MSFT]
Hi Owen,
Here is the complete example cmdlets for your case, these are working fine.
I have verified these on my system.
$pg = Get-ProtectionGroup -DPMServerName TestingServer
$ds = Get-Datasource -ProtectionGroup $pg
$rp = Get-RecoveryPoint -Datasource $ds | where
{$_.RepresentedPointInTime -eq "3/6/2008 10:07:27 PM"}
remove-recoverypoint $rp
make sure you are passing correct $pg and $ds here. As if your system has
more than one PG or more than one DS protected you need to filter them also.
do let me know if you require more info.
Thanks,
Mukul
This posting is provided "AS IS" with no warranties, and confers no
rights.
Post by Owen Clashing
Mukul,
Thanks. I was using the same filter as you were but the problem seems to be
that the leading zero that is shown with the day and month when the
RepresentedPointInTime property is displayed can't be used the property is
being used in a filter.
* Display all recovery points on the server TestingServer
Get-ProtectionGroup -DPMServerName TestingServer | %{Get-Datasource
-ProtectionGroup $_} | %{Get-RecoveryPoint -Datasource $_}
* Display all recovery points on the server TestingServer for the protection
group TestProtectionGroup
Get-ProtectionGroup -DPMServerName TestingServer | where {$_.FriendlyName
-eq "TestProtectionGroup"} | %{Get-Datasource -ProtectionGroup $_} |
%{Get-RecoveryPoint -Datasource $_}
* Display only the recovery point on the server TestingServer for the
protection group TestProtectionGroup for a specific time (day and month
values can't have leading zeros)
Get-ProtectionGroup -DPMServerName TestingServer | where {$_.FriendlyName
-eq "TestProtectionGroup"} | %{Get-Datasource -ProtectionGroup $_} |
%{Get-RecoveryPoint -Datasource $_} | where {$_.RepresentedPointInTime -eq
"3/5/2008 6:00:42 PM"}
* Delete only the recovery point on the server TestingServer for the
protection group TestProtectionGroup for a specific time
Get-ProtectionGroup -DPMServerName TestingServer | where {$_.FriendlyName
-eq "TestProtectionGroup"} | %{Get-Datasource -ProtectionGroup $_} |
%{Get-RecoveryPoint -Datasource $_} | where {$_.RepresentedPointInTime -eq
"3/5/2008 6:00:42 PM"} | %{Remove-RecoveryPoint $_}
Serge Ayotte
2011-06-28 12:54:01 UTC
Permalink
HI all!!

In case you end up like me wondering what are missing, and a way to delete specific recovery points, here is what I did and added to the oneliners...

Once you have the exact date and time via the oneliner that display all recovery point for the specific protection group (second one), I did a little workaround by doing a combination of the third oneliner parsed to a variable (line split manually):
$rp=Get-ProtectionGroup -DPMServerName TestingServer
| where {$_.FriendlyName
-eq "TestProtectionGroup"} | %{Get-Datasource
-ProtectionGroup $_}
|%{Get-RecoveryPoint -Datasource $_}
| where {$_.RepresentedPointInTime
-eq "6/10/2011 05:15:12"}

NOTE your date and time is dependant on the setting on the server. Mine is with mm/dd/yyyy and 24hours (so no AM/PM)

Next I delete the $rp with the simple command:
remove-recoverypoint $rp

Hope this help others that like me where stuck in trying to figure out how to delete recovery point at a specific date and time for a protection group!

Serge

Loading...