PowerShell script exchange
Post Reply
efd121
Enthusiast
Posts: 46
Liked: 2 times
Joined: Aug 07, 2015 8:45 pm
Full Name: David Engler
Contact:

Duplicate restore points?

Post by efd121 »

The script below is my starting point to collect the RPO window for each of my VM's.

My plan is to look at the last 2 restore points and report the time difference between them but I'm running into an issue where my script is reporting duplicate restore points.

I enabled encryption for my backup jobs on the 18th so I'm suspecting its not a coincidence that is when the duplicate restore points start occurring.

As expected a new backup chain was created after encryption was enabled. Should I manually delete the old backup files once I reach the 14 restore points with encryption or is there a better way to re-sync them?

Script

Code: Select all

Add-PSSnapin -Name VeeamPSSnapIn -ErrorAction SilentlyContinue

#$Jobs = Get-VBRJob | Sort-Object Name | ?{$_.JobType -eq "Backup"}
$Jobs = Get-VBRJob -Name "OperationsJob02"
foreach ($Job in $Jobs)
{
$JobObjects = Get-VBRJobObject -Job $Job
foreach ($VM in $JobObjects.Name)
{
$RestorePoints = Get-VBRRestorePoint -Name $VM | Sort-Object -Property CreationTime -Descending
Write-Host "Job="$Job.Name, "VM="$VM, "has", $RestorePoints.Count "restore points"
foreach ($RP in $RestorePoints)
{
Write-Host "Creation Data" $RP.CreationTime
}
}
}
Partial Output from script

Code: Select all

Job= OperationsJob02 VM= fwdws03 has 37 restore points
Creation Data 12/29/2015 6:04:16 PM
Creation Data 12/29/2015 6:04:16 PM
Creation Data 12/28/2015 6:03:30 PM
Creation Data 12/28/2015 6:03:30 PM
Creation Data 12/27/2015 6:03:41 PM
Creation Data 12/27/2015 6:03:41 PM
Creation Data 12/26/2015 6:03:33 PM
Creation Data 12/26/2015 6:03:33 PM
Creation Data 12/25/2015 6:03:19 PM
Creation Data 12/25/2015 6:03:19 PM
Creation Data 12/24/2015 6:03:39 PM
Creation Data 12/24/2015 6:03:39 PM
Creation Data 12/23/2015 6:03:30 PM
Creation Data 12/23/2015 6:03:30 PM
Creation Data 12/22/2015 6:03:23 PM
Creation Data 12/22/2015 6:03:23 PM
Creation Data 12/21/2015 6:03:23 PM
Creation Data 12/21/2015 6:03:23 PM
Creation Data 12/20/2015 6:03:42 PM
Creation Data 12/20/2015 6:03:42 PM
Creation Data 12/19/2015 6:03:30 PM
Creation Data 12/19/2015 6:03:30 PM
Creation Data 12/18/2015 6:03:32 PM
Creation Data 12/17/2015 6:03:33 PM
Creation Data 12/16/2015 6:03:41 PM
Creation Data 12/15/2015 6:03:44 PM
Creation Data 12/14/2015 6:03:31 PM
Creation Data 12/13/2015 6:03:37 PM
Creation Data 12/12/2015 6:03:24 PM
Creation Data 12/11/2015 6:03:46 PM
Creation Data 12/10/2015 6:04:42 PM
Creation Data 12/9/2015 6:03:59 PM
Creation Data 12/8/2015 6:06:43 PM
Creation Data 12/7/2015 6:06:24 PM
Creation Data 12/6/2015 6:08:48 PM
Creation Data 12/5/2015 6:03:18 PM
Creation Data 12/4/2015 6:05:55 PM
PTide
Product Manager
Posts: 6408
Liked: 724 times
Joined: May 19, 2015 1:46 pm
Contact:

Re: Duplicate restore points?

Post by PTide »

Hi,

Do you see duplicate restore points in VBR console as well?

Thank you.
efd121
Enthusiast
Posts: 46
Liked: 2 times
Joined: Aug 07, 2015 8:45 pm
Full Name: David Engler
Contact:

Re: Duplicate restore points?

Post by efd121 »

I do not see them in the console. The console is showing 14 restore points but the script continues to show 28.
Dave
efd121
Enthusiast
Posts: 46
Liked: 2 times
Joined: Aug 07, 2015 8:45 pm
Full Name: David Engler
Contact:

Re: Duplicate restore points?

Post by efd121 »

I think what I'm seeing is the restore points from both the Backup and Backup Copy jobs.

Assuming that is the case how can I tell which restore points are from the Backup Job and which are from the Backup Copy Job?

If I can determine which ones are from the Backup job I should be able to compare the most recent ones.

I looked through object returned from Get-VBRRestorePoint but I don't see anything that ties them to a specific repository.

Can anyone point me in the right direction?
Dave
tdewin
Veeam Software
Posts: 1775
Liked: 646 times
Joined: Mar 02, 2012 1:40 pm
Full Name: Timothy Dewin
Contact:

Re: Duplicate restore points?

Post by tdewin »

You can actually find the info via some of the members. Maybe chaining the queries might not be the cleanest way to script it but just for your info ;)
Repository:

Code: Select all

#name
$rp.GetRepository().Name
#server it is hosted on
$rp.GetRepository().GetHost().Name
Path:

Code: Select all

$rp.GetStorage().filepath
You can discover these fields by adding | gm after your object, this gives you all the possible methods and properties

Code: Select all

$rp | gm
tdewin
Veeam Software
Posts: 1775
Liked: 646 times
Joined: Mar 02, 2012 1:40 pm
Full Name: Timothy Dewin
Contact:

Re: Duplicate restore points?

Post by tdewin »

Forgot to add, the job itself

Code: Select all

$rp.GetSourceJob().Name
efd121
Enthusiast
Posts: 46
Liked: 2 times
Joined: Aug 07, 2015 8:45 pm
Full Name: David Engler
Contact:

Re: Duplicate restore points?

Post by efd121 »

Thanks for all the replies, this should get me the information I'm looking for.
Post Reply

Who is online

Users browsing this forum: No registered users and 21 guests