PowerShell script exchange
Post Reply
expert
Enthusiast
Posts: 30
Liked: 3 times
Joined: May 20, 2016 7:05 am
Contact:

get last point creation time from job

Post by expert »

Hello,

I found a PS script to summarize all the jobs an send an e-mail report
https://www.powershellgallery.com/packa ... Report.ps1

the script works but on the new backup-jobs where retention policy is configured as "days" instead "restore points" I cannot get the "LastPointCreationTime" of the jobs

$LastBackup = $job.GetLastBackup()
$LastBackupStart = [datetime]($LastBackup.LastPointCreationTime)

is there another term that gives me that information?

kind regards,

Juergen
david.domask
Veeam Software
Posts: 1226
Liked: 322 times
Joined: Jun 28, 2016 12:12 pm
Contact:

Re: get last point creation time from job

Post by david.domask »

Hi @expert,

I wouldn't use the methods in that script as they use internal .NET methods which are not supported. Similarly, since it has the old Snapin loading code, I'm guessing the script was written some time ago, so the internal .NET methods likely changed/aren't compatible with newer features.

You should create a function in your script to retrieve points like this:

Code: Select all

PS C:\Users\Administrator> $job =Get-VBRJob -name 'vmware-per-job'
PS C:\Users\Administrator> $Backup = Get-VBRBackup |Where-Object {$_.JobID -eq $job.id}
PS C:\Users\Administrator> $Backup

Job Name                  Type            Creation Time               VM count
--------                  ----            -------------               --------
vmware-per-job            VMware Backup   3/3/2023 1:25:46 PM                2


PS C:\Users\Administrator> $RPs = Get-VBRRestorePoint -Backup $backup |Sort-Object -Property CreationTime -Descending |S
elect -First 1
PS C:\Users\Administrator> $RPs.CreationTime

Monday, May 8, 2023 10:00:42 PM
Right now, $RPs will always be the most recent restore point passed from the backup. However, since you can have multiple items in the job and you want to report on them all, you'll want to write some logic to loop over all the objects returned by Get-VBRJobObject and pass the object Name to

Code: Select all

Get-VBRRestorePoint -Name
argument.
David Domask | Product Management: Principal Analyst
expert
Enthusiast
Posts: 30
Liked: 3 times
Joined: May 20, 2016 7:05 am
Contact:

Re: get last point creation time from job

Post by expert »

Hello,

thanks for the tip! I'll have a look a at it and make some test

regards,

Juergen
Post Reply

Who is online

Users browsing this forum: No registered users and 12 guests