PowerShell script exchange
Post Reply
mckaj
Novice
Posts: 8
Liked: never
Joined: Feb 24, 2016 9:30 pm
Contact:

Can you get to this level of backup data in powershell

Post by mckaj »

Suggested that I post this in Powershell forum from original post in Veeam forum:

Hi All,

Not sure if it is possible to do this, but would like to extract specific line data from our Veeam backup history.

For example there is a line in each server in each job in history that says:
Removing VM Snapshot -> (Duration) h:mm:ss

I would like to (preferably programatically) pull all of those lines from all jobs for all servers for a specific date range.

I have had a delve into the SQL database. It seems remarkably well structured from my limited knowledge of SQL, but I have not worked out how to find this data in the tables.

Is it possible to get this data via powershell?

Cheers
Andrew
resruss
Service Provider
Posts: 56
Liked: 6 times
Joined: Apr 30, 2012 2:04 am
Contact:

Re: Can you get to this level of backup data in powershell

Post by resruss »

This might be one of those things that is stored in the job logs as txt.
You may be able to pull that data from vPower CLI, or try using something like sexilog to poll vCenter via SNMP and graph it.
veremin
Product Manager
Posts: 20284
Liked: 2258 times
Joined: Oct 26, 2012 3:28 pm
Full Name: Vladimir Eremin
Contact:

Re: Can you get to this level of backup data in powershell

Post by veremin »

I've created a rough example; it should give you some directions, though:

Code: Select all

asnp VeeamPSSnapin
$Job = Get-VBRJob -Name "Name of your Job"
$BackupSession = $Job.FindLastSession()
$TaskSessions = $BackupSession.GetTaskSessions()
$report = @()
Foreach ($TaskSession in $TaskSessions)
{
$TaskSessionObject = New-Object psobject
$TaskSessionObject | Add-Member -membertype NoteProperty -name "VMName" -Value $TaskSession.Name
$TaskSessionObject | Add-Member -membertype NoteProperty -name "SnapshotCreationTime" -Value ($TaskSession.Logger.GetLog().UpdatedRecords | where {$_.Title -like "*Removing*"}).StartTime
$TaskSessionObject | Add-Member -membertype NoteProperty -name "SnapshotRemovalTime" -Value ($TaskSession.Logger.GetLog().UpdatedRecords | where {$_.Title -like "*Removing*"}).UpdateTime 
$report += $TaskSessionObject
}
$report
Thanks.
Post Reply

Who is online

Users browsing this forum: No registered users and 14 guests