PowerShell script exchange
Post Reply
PedroVDP
Service Provider
Posts: 19
Liked: 2 times
Joined: Jan 18, 2012 9:10 am
Contact:

Getting postprocessing details from backup sessions

Post by PedroVDP »

I've made some scripts to do some custom reporting using powershell on our jobs with relative success but there's a few jobs that need some extra hand-holding.

Essentially some massive VMs have 300-500 GB of new stored data every day which sometimes can lead to extreme merge operations on forever incremental jobs.

In order to create some reports I'm de-constructing each part of the job's total duration but while it's easy to get the details on an individual VM in a job by listing the task sessions, I'm having trouble finding out where I can get the duration of the post-processing using powershell.

If anyone has a better suggestion, I'd welcome the help.

What I have so far is something along the lines of the below which gets me all details of each individual VM but not the post-processing of the job. Somehow it seems a bit crude to have to sum up all task sessions and subtract it from the total job durations but that's the best I could come up with so far.

Code: Select all

..snip...
foreach ($backup in $vbrsessions) {
		$Sessions = $backup.GetTaskSessions()
		foreach ($VM in $Sessions) {
		# Get Array Data
		$JobName = $backup.OrigJobName
		$Name = $VM.Name
		$Status = $VM.status
		$Size = [Math]::Round([Decimal]$VM.Progress.ProcessedSize/1GB,2)
		$Used = [Math]::Round([Decimal]$VM.Progress.ProcessedUsedSize/1GB,2)
		$Read = [Math]::Round([Decimal]$VM.Progress.Readsize/1GB,2)
		$Stored = [Math]::Round([Decimal]$VM.Progress.StoredSize/1GB,2)
		$Start = $VM.progress.starttime 
		$Finish = $VM.progress.stoptime
		$Duration = '{0:00}:{1:00}:{2:00}' -f ($VM.progress.duration | % {$_.Hours, $_.Minutes, $_.Seconds})
        $retry = ($backup.name).split("(")[2] -replace "\)"
		$Message = $VM.GetDetails()

}
...snip...
tsightler
VP, Product Management
Posts: 6035
Liked: 2860 times
Joined: Jun 05, 2009 12:57 pm
Full Name: Tom Sightler
Contact:

Re: Getting postprocessing details from backup sessions

Post by tsightler »

I'm assuming by post-processing you mean things like synthetic fulls and merges. Unfortunately I don't know if there's any great way to get those details from specific properties, but you can do a little creative log parsing for the job, so something like:

Code: Select all

$backup.Logger.GetLog().UpdatedRecords | ?{$_.Title -like "*backup file merge*"}
This should return the log entry for the merge or synthetic operation which includes both a status and a start and end time property. To make it work reliably you'll probably need to tweak the exact phrase match, but I've used this approach to reasonable success in the past.
PedroVDP
Service Provider
Posts: 19
Liked: 2 times
Joined: Jan 18, 2012 9:10 am
Contact:

Re: Getting postprocessing details from backup sessions

Post by PedroVDP »

For merges that would be "Full backup file merge completed successfully" actually.

Thanks, this should do the trick in getting the data out.
Post Reply

Who is online

Users browsing this forum: No registered users and 11 guests