Get Statistics subtask with powershell

PowerShell script exchange

Get Statistics subtask with powershell

Veeam Logoby cstaubli » Wed Jul 03, 2013 7:05 am

Hello all

I'm looking for a way to get some information from job statistics via powershell. Especially I'm interested in removing vm snapshot time for each VM in a certain job. In GUI you can right click a job, choose statistics, select a VM and scroll down to this entry. Is it possible or do I have to look for this information directly in DB?

Thanks in advance
Christian
cstaubli
Service Provider
 
Posts: 10
Liked: 2 times
Joined: Fri Feb 08, 2013 8:45 am
Full Name: Christian

Re: Get Statistics subtask with powershell

Veeam Logoby cstaubli » Wed Jul 03, 2013 7:45 am 1 person likes this post

Nevermind, I found a solution:
Code: Select all
$Jobs = Get-VBRJob -Name "Name*"
foreach ($Job in $Jobs) {
   $LastSession = $Job.FindLastSession()
   $TaskSessions = $LastSession | Get-VBRTaskSession
   foreach ($vm in $TaskSessions) {
      $asd = $vm.Logger.GetLog().UpdatedRecords | where-object {$_.title -eq "Removing VM snapshot"} | Select-Object title, starttime, updatetime
      $diff = $asd.updatetime - $asd.starttime
      Write-Host $vm.Name `t $diff.TotalMinutes
   }
}
cstaubli
Service Provider
 
Posts: 10
Liked: 2 times
Joined: Fri Feb 08, 2013 8:45 am
Full Name: Christian

Re: Get Statistics subtask with powershell

Veeam Logoby v.Eremin » Wed Jul 03, 2013 10:28 am

I have to admit you wrote a nice script, indeed. Thanks for sharing it with the community; highly appreciated.
v.Eremin
Veeam Software
 
Posts: 13701
Liked: 1020 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 2 guests