Get Recover Point Expiration Date in DPM Management Shell

Hello,

I am currently using DPM 2010 and am trying to retrieve the Expiration Dates for individual Recovery Points using the DPM Management shell. I know I can retrieve this information by viewing the tape contents in the DPM console but, I would like to be able to utilize the information in scripts if possible.

I have seen THIS POST. However, the provided solution has been unsuccessful in my attempts. I am assuming by "get-rps" they meant "get-recoverypoint" which makes sense but, I dont see any methods with a similar name or apparent function to get-expirydate.

I find it hard to believe you cannot retrieve this information from the DPM Shell but, by the silence of my search results, it just might be.

I look forward to Reading your responses, even if they are telling me it can't be done, or that i missed something in my searches. 

  • Moved by MarcReynolds Friday, May 20, 2011 3:15 PM (From:Data Protection Manager)
March 18th, 2011 2:25am

I don't have any tapes in my test environment...  But here's my best guess:

$tapes=get-tape -dpmserver my_dpm
$rps=get-recoverypoint -tape $tapes
$rps|foreach{$_.expirydate}

Give that a try...

You might need to do something like this instead though:

$tapes=get-tape -dpmserver my_dpm
$rps=get-recoverypoint -tape $tapes[0]
$rps|foreach{$_.expirydate}

Note that in the second line above, I pick a particular element from the tapes array...

Free Windows Admin Tool Kit Click here and download it now
March 19th, 2011 3:59am

I don't see "ExpiryDate" as a property for a recovery point object.  I think that's where the OP got stuck, too.
March 19th, 2011 2:40pm

I think it makes more sense for an expiration date property to be on an actual tape object, but I don't see it there either.
Free Windows Admin Tool Kit Click here and download it now
March 19th, 2011 2:50pm

I only have disks...  Do you think there's a way to recreate/simulate the same thing, but with disks?
March 19th, 2011 4:03pm

Hi Marco,

You can load the Firestreamer demo here is the link http://www.cristalink.com/fs/ . This will let you make your disks look as if they are tapes and then you can keep testing.

Free Windows Admin Tool Kit Click here and download it now
March 19th, 2011 10:40pm

Hi Marco,

You can load the Firestreamer demo here is the link http://www.cristalink.com/fs/ . This will let you make your disks look as if they are tapes and then you can keep testing.


Cool!  Downloading now!
March 20th, 2011 2:50am

As Rod said, I don't see a property called anything similiar to expirydate in either the tape object or the recoverypint object.

I do see a getDatasetLifeStatus Method in the tape object. It looks interesting, but I can’t seem to get it to produce anything useful.

Perhaps my syntax is wrong? I've tried the following

· $Tapes.getDatasetLifeStatus

· $Tapes.getDatasetLifeStatus()

Though, I must admit, I'm relatively new to both, PowerShell and DPM so I may be off base there.

I’m not 100% sure the expiriation date would be stored in the tape object, as I do have colocation turned on and a single tape can have recovery points that show as having different expiration dates in the DPM Administrator Console

My next idea is to see if I can perhaps, find any properties stating which recovery points are part of Which recovery goal set for each protection group and then adding my specified retention range to the RepresentedPointInTime for the recovery point.

Free Windows Admin Tool Kit Click here and download it now
March 21st, 2011 7:46pm

Perhaps my syntax is wrong? I've tried the following

· $Tapes.getDatasetLifeStatus

· $Tapes.getDatasetLifeStatus()


When you have an array of elments, like $tapes, my guess would be this syntax:

$tapes|foreach{$_.getdatasetlifestatus()}

March 21st, 2011 9:24pm

Oops, good call. I actually know better than that, I promise.

unfortunately this only seems to return the value of the "DatasetState" property which says whether the tape  is "valid", or "recyclable" (all recoverypionts on the tape have expired)


It seems this was not the elusive method, I was hoping for.

Free Windows Admin Tool Kit Click here and download it now
March 21st, 2011 9:46pm

I've pretty much came to the conclusion that there isnt going to be a simple and straight foreward way to find this information, so ive started looking into other options

Well, im geting a little closer at least. i was exploring the get-policyobjective cmdlet and found that the policyobjective object has a property called schedules which has a method called getretension()

so....

$po = get-policyobjective -ProtectionGroup $pg -longTerm Tape

will set $po as a policyobjective object for whichever protectiongroup is set to the $pg variable.. and...

$po.schedules

will give you a list of Schedules which create recoverypoints in given PG

$po.schedules[x].getretention($pg)

will give you the retention range for each recoverypoint created for x schedule

 

...now that i can find a way to determine the set recovery goals within powershell, i just need to find out if there is a way to see which schedule created which RPs and I would be able to create a script that calculates the expiration date using this this information.

 

 

March 24th, 2011 1:40am

Don't give up yet.  I just haven't had time to install that tool BuchaTech mentioned...
Free Windows Admin Tool Kit Click here and download it now
March 24th, 2011 4:09am

Im not giving up, by other options what i meant is just looking in more abstract places. this issue has really turned into somthing that willl help me understand more and more about the inner workings of DPM and in the end. That is what is really important.

I definately appreciate all of your help so far.

March 24th, 2011 8:49am

I just played for this for a bit, and can't figure it out.  Sorry...  I don't know enough about DPM either and tried digging a bit into not only the original question, but some things you discussed later in the thread, and still can't find anything to help you.
Free Windows Admin Tool Kit Click here and download it now
March 27th, 2011 4:01pm

I deffinately still thank you for your help. I will certainly keep poking around and will post back if i find a solution.

My dpm knowledge has deffinately increased since looking into this, so it's still a win in my book either way.

 

 

March 28th, 2011 6:28pm

Hi Jason.Ro

 

I see your last post was on March 28.

 

Do you still need help on having this addr

Free Windows Admin Tool Kit Click here and download it now
May 21st, 2011 1:07am

Hi Guys

I am also trying to find / build a script that does what Jason.Ro is/was busy with here.  My end-goal is to send a reminder mail to my branch admins, containing the list of tapes to remove from which slots from the Library, and which tapes to insert into the library (once expiry is reached).

A script like this will prove extremely valueble to me.

This is what I have so far:

--------------------------------------------------------

 

$MonToThu = "Monday","Tuesday","Wednesday","Thursday"
$FriOnly = "Friday"
$SunOnly = "Sunday"
$CurDate = Get-Date
If ($MonToThu -Contains $CurDate.DayOfWeek) {$Freq = "Daily"}
ElseIf ($FriOnly -Contains $CurDate.DayOfWeek) {$Freq = "Weekly"}
ElseIf ($SunOnly -Contains $CurDate.DayOfWeek) {$Freq = "Monthly"}

$PGroup = Get-ProtectionGroup -DPMServerName CADjhbMGT01a | where {$_.IsTapeLongTerm -eq $True}
ForEach ($PG in $PGroup) {
$PObjective = Get-PolicyObjective -ProtectionGroup $PG -LongTerm Tape
$BObjective = $PObjective.Schedules | Where {$_.Frequency -eq $Freq}


Write-Host "Retention Period -" $BObjective.Getretention($PG).IntervalPair


If ($BObjective.Getretention($PG).IntervalPair.Value -eq "Weeks")
    {
    $AmountWeeks = $BObjective.Getretention($PG).IntervalPair.Key
    $AmountDays = ($AmountWeeks * 7) + 1
    $ReturnDate = $CurDate.AddDays($AmountDays)
    Write-Host $ReturnDate
    }
}

 

--------------------------------------------------------

Unfortunately I am Junior in PowerShell and will greatly appreciate further assistance.

 

 

Thanks in advance!





June 20th, 2011 2:32pm

Hi Wayne,

 

I am working on a script that would give you that info. It is currently in the test phase.... :)

Free Windows Admin Tool Kit Click here and download it now
June 28th, 2011 8:51am

Sorry for the long time to post back.

This script will list how many recovery point was written to an Offsite ready tape. It will show the date it was written and the date it will expire.

If there is a tape which content still to expire but the tape isn't in the Library, you will get a warning state which date this tape should be back. Let me know if there is something else you want to see in the output.

 

# Author: Wilson Souza
# Version: V 0.3 - Draft
# Script created - 06/26/11
# Last updated  - 6/28/11 1:46 PM CST
#
# This script will parse all active protection group that is configured for long term protection to tape
# It will parse all tapes which are already set as offsite ready
# It will list all expiration date of these tapes. Currently it will list a tape even if it is set to expire months or years in advance.
#
# version 0.3 - Output now is saved on file duetape.txt
# Version 0.2 - Expire date/time information was masked to only show the date but not the time. Took mask out so now we return date and time.

$confirmpreference = "None"
cls
$dpmserver = connect-dpmserver (&hostname)
$pg = @(get-protectiongroup (&hostname) | where { $_.protectionmethod -like "*Long-term using tape*"}) 
out-file duetape.txt -encoding ASCII
foreach ($pg1 in $pg)
{
	$rp = @()
	write-host "Protection Group" $pg1.friendlyname "has tape protection" -foreground white
	$ds = @(get-datasource $pg1)
	foreach ($ds1 in $ds)
	{
		if ((get-recoverypoint $ds1 | where { $_.datalocation -eq "Media"}) -ne $null)
		{
			$rp = $rp + (get-recoverypoint $ds1 | where { $_.datalocation -eq "Media"})
		}
	}
	$tp = @(get-tape -protectiongroup $pg1)
	foreach ($tp1 in $tp)
	{
		if ($tp1.Isoffsiteready -eq $true)
		{
			$expire = get-date 
			write-host "Recovery Points present on tape with barcode" $tp1.barcode 
			foreach ($rp1 in $rp)
			{
				if ($tp1.id -eq $rp1.RecoverySourceLocations[0].mediamaplist[$rp1.RecoverySourceLocations[0].mediamaplist.count-1].mediaid)
				{
					write-host $rp1.RecoverySourceLocations[0].creationdatetime " - " $rp1.RecoverySourceLocations[0].expirydate " - " $tp1.barcode "- " $rp1.recoverysourcelocations[0].generation -foreground red
					if ($expire -lt $rp1.RecoverySourceLocations[0].expirydate)
					{
						$expire = ($rp1.recoverysourcelocations[0].expirydate)
					}
				}
					
			}
			if ($tp1.location.isoffline)
			{
				write-host "Offsite Tape with barcode" $tp1.barcode "is due back to Library on" $expire "`n" -foreground yellow
				"Offsite Tape with barcode " + $tp1.barcode + " is due back to Library on " + $expire | out-file duetape.txt -encoding ASCII -append
			}
			else
			{
				write-host "Tape in" $tp1.location.name "-" $tp1.location.id "expires on" $expire "`n" -foreground green
				"Tape in " + $tp1.location.name + "-" + $tp1.location.id +" expires on " + $expire | out-file duetape.txt -encoding ASCII -append
			}
		}
	}
}

July 22nd, 2011 1:57am

I tried something like this.. thanks to Wilson for RecoverySourceLocations[0].expiryDate

$tapes=get-tape -dpmserver mydpm
$tapes | foreach { get-recoverypoint $_ | foreach {$_, $_.RecoverySourceLocations[0].expiryDate} | format-table Datasource,RepresentedP
ointInTime,UTcRepresentedPointInTime, date}

This gives you the Each of the RecoveryPoints with respective Expiration Date.

Hope this helps.

Free Windows Admin Tool Kit Click here and download it now
January 3rd, 2012 11:44pm

Fantastic script! Thanks, I have been looking for something like this for months.

I do not use barcodes in my environment, so the output says "barcode:none" and does dont give me the tape name.

What wold I need to change to reflect the tape friendly name rather than barcode.

I get the following in the output:

Tape in Drive - a3bb5cf8-3c12-4f45-ad91-b8150bcab1fc expires on 13/03/2012 4:00:20 p.m.

But the what I need is the Name displayed when viewing tape contents in the GUI. I believe the database stores it as the medialabel  in the dbo.vw_DPM view in the database

  • Edited by Mark Lilly2 Tuesday, March 13, 2012 3:05 AM
March 13th, 2012 4:17am

Like Tape Label?
Free Windows Admin Tool Kit Click here and download it now
March 13th, 2012 4:35am

Yes, The tape label would be fine. DPM gives the tape a name which i print as a label and put on the tape
March 13th, 2012 5:56am

Hi,

Try this new version of the script. It is pretty much the same script I just added an entry that if you do supply a switch label, it will output the label of the tape instead of the tape barcode. Example: if the script is named duetape.ps1 you just run like this:

.\duetape.ps1 label
################################################################################################
#                                                                                              #
# This script will parse all active protection group that is configured for long term          #
# protection to tape                                                                           #
# It will parse all tapes which are already set as offsite ready                               #
# It will list all expiration date of these tapes. Currently it will list a tape even if it is #
# set to expire months or years in advance.                                                    #
#                                                                                              #
# Author        : Wilson Souza                                                                 #
# Script Name   : wilson-duetape.ps1                                                           #
# Date Created  : 06/26/2011                                                                   #
# Last modified : 03/13/2012                                                                   #
# Version       : 1.3                                                                          #
#                                                                                              #
# Change log                                                                                   #
# ==========                                                                                   #
#                                                                                              # 
#       Ver 1.3 - Added option to show output with Tape Label instead of Barcode               #
#                 To switch to Label just enter the script name followed by word label         #
#                 Example: .\duetape.ps1 label                                                 #
#       Ver 1.2 - Output now is saved on file duetape.txt                                      #
#       Ver 1.1 - Expire date/time information was masked to only show the date but not the    #
#                 time. Took mask out so now we return date and time.                          #
#                                                                                              #
# This version of the script was only tested on DPM 2010                                       #
#                                                                                              #
################################################################################################

param([string] $barcode)
if ($barcode.toupper() -ne 'LABEL') { $barcode = 'barcode' }
$confirmpreference = "None"
cls
$dpmserver = connect-dpmserver (&hostname)
$pg = @(get-protectiongroup (&hostname) | where { $_.protectionmethod -like "*Long-term using tape*"}) 
out-file duetape.txt -encoding ASCII
foreach ($pg1 in $pg)
{
	$rp = @()
	write-host "Protection Group" $pg1.friendlyname "has tape protection" -foreground white
	$ds = @(get-datasource $pg1)
	foreach ($ds1 in $ds)
	{
		if ((get-recoverypoint $ds1 | where { $_.datalocation -eq "Media"}) -ne $null)
		{
			$rp = $rp + (get-recoverypoint $ds1 | where { $_.datalocation -eq "Media"})
		}
	}
	$tp = @(get-tape -protectiongroup $pg1)
	foreach ($tp1 in $tp)
	{
		if ($tp1.Isoffsiteready -eq $true)
		{
			$expire = get-date 
			write-host "Recovery Points present on tape with" $barcode $tp1.$barcode 
			foreach ($rp1 in $rp)
			{
				if ($tp1.id -eq $rp1.RecoverySourceLocations[0].mediamaplist[$rp1.RecoverySourceLocations[0].mediamaplist.count-1].mediaid)
				{
					write-host $rp1.RecoverySourceLocations[0].creationdatetime " - " $rp1.RecoverySourceLocations[0].expirydate " - " $tp1.$barcode "-" $rp1.recoverysourcelocations[0].generation -foreground red
					if ($expire -lt $rp1.RecoverySourceLocations[0].expirydate)
					{
						$expire = ($rp1.recoverysourcelocations[0].expirydate)
					}
				}
					
			}
			if ($tp1.location.isoffline)
			{
				write-host "Offsite Tape with" $barcode $tp1.$barcode "is due back to Library on" $expire "`n" -foreground yellow
				"Offsite Tape with " + $barcode + " " + $tp1.$barcode + " is due back to Library on " + $expire | out-file duetape.txt -encoding ASCII -append
			}
			else
			{
				write-host "Tape in" $tp1.location.name "-" $tp1.location.id "expires on" $expire "`n" -foreground green
				"Tape in " + $tp1.location.name + "-" + $tp1.location.id +" expires on " + $expire | out-file duetape.txt -encoding ASCII -append
			}
		}
	}
}

Let me know if worked

Free Windows Admin Tool Kit Click here and download it now
March 13th, 2012 9:01am

Thanks Wilson, I appreciate your efforts.

Here  is the output I am receiving

The script failed due to call depth overflow.  The call depth reached 1001 and the maximum is 1000.
    + CategoryInfo          : InvalidOperation: (1001:Int32) [], ParentContainsErrorRecordException
    + FullyQualifiedErrorId : CallDepthOverflow

March 13th, 2012 10:47pm

Did you get something as output or just the error?

If you run without the label switch does it fail in the same way?

Free Windows Admin Tool Kit Click here and download it now
March 13th, 2012 10:49pm

Just the error. I then ran it without the label switch and got the same error.

March 13th, 2012 11:10pm

The script works for me.

Did you close/open DPM Shell before running the script?

Free Windows Admin Tool Kit Click here and download it now
March 13th, 2012 11:29pm

I have closed and reopened DPM shell and retried. Same result.

I am only running version 1.0 of powershell. could that be an issue?

March 13th, 2012 11:38pm

The only server I have with PowerShell V1 I don't have backup to tape configured so the script runs and returns nothing (as expected) and doesn't throw me that error...

The original script isn't causing you this issue, right?

Free Windows Admin Tool Kit Click here and download it now
March 13th, 2012 11:41pm

Correct, the original script runs with no errors.

I will run a windows update on the box to see if that improves the situation. It has not had any updates since Mid January.

Doing a quick bit of research, I think this might be the issue I am hitting: http://twistednutproductions.com/?p=312

Windows update completed. Server restarted, re-run script = same error

  • Edited by Mark Lilly2 Tuesday, March 13, 2012 10:42 PM updated
March 13th, 2012 11:52pm

Hi Guys,

i want to let you know that i have written a Scirpt, the Problem with the Script of wilson ist, that the Expiration Date is not the correct one, in case a Tape can have diffeent Expiration Dates.

I posted my Script on my Blog: http://www.techguy.at/2014/01/17/auslesen-der-dpm-tapes-inklusive-ablaufdatum/#more-4005

regards Michael

Free Windows Admin Tool Kit Click here and download it now
January 17th, 2014 12:02pm

This topic is archived. No further replies will be accepted.

Other recent topics Other recent topics