PowerShell script exchange
Post Reply
Henrik.Grevelund
Service Provider
Posts: 160
Liked: 18 times
Joined: Feb 13, 2017 2:56 pm
Full Name: Henrik Grevelund
Contact:

Nas backup stats

Post by Henrik.Grevelund »

Hi There,

I am trying to find some of the backup statistics for the Nas job.

For the entire job i can find the totalaize, Readsize & Transferedsize.
But i can't seem to find the Files proccessed, Read & Transferred.

For each share in the job i can count the number of restore points using Get-VBRNASBackupRestorePoint
I would like to get these numbers for each restore point:
Files proccessed, Read & Transferred.

Anyone found this using powershell ?
Have nice day,
Henrik
oleg.feoktistov
Veeam Software
Posts: 1912
Liked: 635 times
Joined: Sep 25, 2019 10:32 am
Full Name: Oleg Feoktistov
Contact:

Re: Nas backup stats

Post by oleg.feoktistov »

Hi Henrik,

It's task session progress info you are after. But precisely for NAS task session there isn't any supported way/cmdlet to retrieve files transfer statistics over PS.
Try the static .NET method as per the example below:

Code: Select all

$sessions = Get-VBRBackupSession | where {$_.Result -eq 'Success' -and $_.JobType -eq 'NASBackup'}
$taskSession = Get-VBRTaskSession -Session $session[0]
[Veeam.Backup.Core.CBackupTaskSessionProgress]::FindNasBackupTaskSessionsProgressByTaskSessionId($taskSession.Id)
Hope it helps,
Oleg
Henrik.Grevelund
Service Provider
Posts: 160
Liked: 18 times
Joined: Feb 13, 2017 2:56 pm
Full Name: Henrik Grevelund
Contact:

Re: Nas backup stats

Post by Henrik.Grevelund »

Hi Oleg,

I haven't used the .net before so maybee i am missing something because i get this error:

Code: Select all

[Veeam.Backup.Core.CBackupTaskSessionProgress]::FindNasBackupTaskSessionsProgressByTaskSessionId($taskSession.Id)

Cannot convert argument "taskSessionsId", with value: "System.Object[]", for "FindNasBackupTaskSessionsProgressByTaskSessionId" to type "System.Guid": "Cannot convert the "System.Object[]" value of type "System.Object[]" to type "System.Guid"."
At line:2 char:1
+ [Veeam.Backup.Core.CBackupTaskSessionProgress]::FindNasBackupTaskSess ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : NotSpecified: (:) [], MethodException
    + FullyQualifiedErrorId : MethodArgumentConversionInvalidCastArgument
Have nice day,
Henrik
oleg.feoktistov
Veeam Software
Posts: 1912
Liked: 635 times
Joined: Sep 25, 2019 10:32 am
Full Name: Oleg Feoktistov
Contact:

Re: Nas backup stats

Post by oleg.feoktistov »

Hi Henrik,

It means that $taskSession variable holds multiple objects and FindNasBackupTaskSessionsProgressByTaskSessionId() method accepts only one. A loop should resolve it:

Code: Select all

$sessions = Get-VBRBackupSession | where {$_.Result -eq 'Success' -and $_.JobType -eq 'NASBackup'}
$taskSessions = Get-VBRTaskSession -Session $session[0]
$sessionsSum = @()
foreach ($taskSession in $taskSessions) {
    $taskProgress = [Veeam.Backup.Core.CBackupTaskSessionProgress]::FindNasBackupTaskSessionsProgressByTaskSessionId($taskSession.Id)
    $sessionsSum += $taskProgress
}
Or for querying multiple sessions recursively with task sessions within:

Code: Select all

$sessions = Get-VBRBackupSession | where {$_.Result -eq 'Success' -and $_.JobType -eq 'NASBackup'}
$sessionsSum = @()
foreach ($session in $sessions) {
    $taskSessions = Get-VBRTaskSession -Session $session
    foreach ($taskSession in $taskSessions) {
      $taskProgress = [Veeam.Backup.Core.CBackupTaskSessionProgress]::FindNasBackupTaskSessionsProgressByTaskSessionId($taskSession.Id)
      $sessionsSum += $taskProgress
    }
}
Thanks!
Henrik.Grevelund
Service Provider
Posts: 160
Liked: 18 times
Joined: Feb 13, 2017 2:56 pm
Full Name: Henrik Grevelund
Contact:

Re: Nas backup stats

Post by Henrik.Grevelund »

Hi Oleg,

Thanks. That helped alot.
Have nice day,
Henrik
Erwin Linker
Service Provider
Posts: 80
Liked: 8 times
Joined: Mar 30, 2016 12:58 pm
Full Name: Erwin Linker
Location: The Netherlands
Contact:

Re: Nas backup stats

Post by Erwin Linker »

Hi,

Quick question, is it also possibly to get the storage size of a restorepoint?
oleg.feoktistov
Veeam Software
Posts: 1912
Liked: 635 times
Joined: Sep 25, 2019 10:32 am
Full Name: Oleg Feoktistov
Contact:

Re: Nas backup stats

Post by oleg.feoktistov »

Hi Erwin,

I suppose you ask about NAS restore points. So I'll answer in regards to that, but please tell me if you meant regular ones.
There is no such notion as isolated storage when it comes to NAS restore points. On backup repo storages are rather shared between them.
So, there is no way to explicitly tell how much of a storage size does NAS restore point take.
Besides the methods to retrieve statistics mentioned in this topic, there are such notions as short-term (resides on regular repo) and long-term (resides on archive repo) backups of the share. Now, as far as I can tell, there is info on their sizes in VBR DB, but methods to get these are not implemented, so unfortunately I can't advise here anything even in terms of .NET

Best regards,
Oleg
Post Reply

Who is online

Users browsing this forum: No registered users and 21 guests