Can you get to this level of backup data in powershell

PowerShell script exchange

Can you get to this level of backup data in powershell

Veeam Logoby mckaj » Wed Jun 15, 2016 1:54 am

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
mckaj
Novice
 
Posts: 5
Liked: never
Joined: Wed Feb 24, 2016 9:30 pm

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

Veeam Logoby resruss » Wed Jun 15, 2016 2:11 am

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.
resruss
Service Provider
 
Posts: 55
Liked: 6 times
Joined: Mon Apr 30, 2012 2:04 am

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

Veeam Logoby v.Eremin » Tue Jun 21, 2016 10:09 am

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.
v.Eremin
Veeam Software
 
Posts: 13255
Liked: 968 times
Joined: Fri Oct 26, 2012 3:28 pm
Full Name: Vladimir Eremin


Return to PowerShell



Who is online

Users browsing this forum: No registered users and 4 guests