PowerShell script exchange
Post Reply
Henrik.Grevelund
Expert
Posts: 103
Liked: 14 times
Joined: Feb 13, 2017 2:56 pm
Full Name: Henrik Grevelund
Contact:

Get-VBRNASBackupFLRItem returning different number of files on same restore point

Post by Henrik.Grevelund »

Hi There

Anyone tried to use Get-VBRNASBackupFLRItem ?
I get a different number of files each time, also asking the same restore session twice ?

I use this:

Code: Select all

$NasServer = Get-VBRNASServer -Name $ShareName
$NasBackup = Get-VBRNASBackup -Name $JobName
$NasRestorepoints = Get-VBRNASBackupRestorePoint -NASServer $NasServer -NASBackup $NasBackup
$LatestRestorepoint = $NasRestorepoints | Sort-Object -Property Creationtime | Select-Object -Last 1

$FLRsession = Start-VBRNASBackupFLRSession -RestorePoint $LatestRestorepoint

$Filelist = Get-VBRNASBackupFLRItem -Session $FLRsession -Recurse
$filelist.count

Stop-VBRNASBackupFLRSession -Session $FLRsession
Have nice day,
Henrik

oleg.feoktistov
Veeam Software
Posts: 1013
Liked: 366 times
Joined: Sep 25, 2019 10:32 am
Full Name: Oleg Feoktistov
Contact:

Re: Get-VBRNASBackupFLRItem returning different number of files on same restore point

Post by oleg.feoktistov »

Hi Henrik,

I couldn't reproduce the same issue in my lab. Does it happen when you try to get NASBackupFLRItem in the same session
or when you try to get it in different sessions stopping and starting them again each time?

Thanks,
Oleg

Henrik.Grevelund
Expert
Posts: 103
Liked: 14 times
Joined: Feb 13, 2017 2:56 pm
Full Name: Henrik Grevelund
Contact:

Re: Get-VBRNASBackupFLRItem returning different number of files on same restore point

Post by Henrik.Grevelund »

Hi Oleg,

It happens in both situations.

Case # 04795121
Have nice day,
Henrik

oleg.feoktistov
Veeam Software
Posts: 1013
Liked: 366 times
Joined: Sep 25, 2019 10:32 am
Full Name: Oleg Feoktistov
Contact:

Re: Get-VBRNASBackupFLRItem returning different number of files on same restore point

Post by oleg.feoktistov »

Thanks for sharing the case id. Let's see what support engineers find out. I'll follow your case closely. Thanks!

djustins
Novice
Posts: 6
Liked: never
Joined: May 31, 2019 1:45 pm
Full Name: Justin Davis
Contact:

Re: Get-VBRNASBackupFLRItem returning different number of files on same restore point

Post by djustins »

Yes, i've dealt with this issue. The problem is with the number of files -- it never loads all of them. I don't have a solution if you want to count all the number of files via the get command, but if you're just looking to do a restore, you have to use a loop to step through the path, like below:

Code: Select all

    #Split the path into an array
    $sSource = $source.trim("/").split("/")
    #Get the parent folder and store as a object
    $Parent = Get-VBRNASBackupFLRItem -Session $Session -Name $sSource[0]
    #Swap the parent name to the child name to work on.
    $ChildName = $Parent.Name
    
    #loop through path doing the above until you get to the object (file or folder) you want to restore. 
    for($i=1;$i -le $sSource.length-1;$i++){
        $ChildName = $ChildName + "|" + $sSource[$i]
        $Child = Get-VBRNASBackupFLRItem -Session $Session -Folder $Parent | where-object {$_.Name -eq $ChildName}
        $Parent = $Child
    }
    
    return $Child

Henrik.Grevelund
Expert
Posts: 103
Liked: 14 times
Joined: Feb 13, 2017 2:56 pm
Full Name: Henrik Grevelund
Contact:

Re: Get-VBRNASBackupFLRItem returning different number of files on same restore point

Post by Henrik.Grevelund »

Hi Justin,

Thank you for your code-snip. Nice and clean code.

Veeam support has provided a registry key to set the max number returned. I have tried it and it does work. But if the number of files are higher it still returns a random number.

NasRestoreBrowserMaxListCount
Type: REG_DWORD
Value: 50000
Path: HKEY_LOCAL_MACHINE\SOFTWARE\Veeam\Veeam Backup and Replication\

I am still working on getting it recognized as a bug that it returns a random number.
Have nice day,
Henrik

oleg.feoktistov
Veeam Software
Posts: 1013
Liked: 366 times
Joined: Sep 25, 2019 10:32 am
Full Name: Oleg Feoktistov
Contact:

Re: Get-VBRNASBackupFLRItem returning different number of files on same restore point

Post by oleg.feoktistov »

Hi Henrik,

Double checked it with QA. This behaviour has nothing to do with Get-VBRNASBackupFLRItem cmdlet as it is the core logic of recursive search on NAS FLR, which is related to the way agent reads data from a mounted backup. So, in the UI it also works like that: it keeps returning different elements count each time until you adjust the reg key above or click on "Show All" button at the bottom of NAS FLR browser.

Most likely I couldn't reproduce it because I had too few files in a NAS share, which didn't hit the default browser max list value.

I do think, though, that we need -ShowAll parameter for Get-VBRNASBackupFLRItem to mirror the UI behaviour. So, I noted it as a feature request.

Thanks,
Oleg

Henrik.Grevelund
Expert
Posts: 103
Liked: 14 times
Joined: Feb 13, 2017 2:56 pm
Full Name: Henrik Grevelund
Contact:

Re: Get-VBRNASBackupFLRItem returning different number of files on same restore point

Post by Henrik.Grevelund »

Hi Oleg,

If this isn't a bug, shouldn't the documentation then say that it will return a random number if the folder contains more than 10.000(or the hidden value in registry) ?

Are you saying that the UI also will show a wrong number of files without any warnings until you press a button ?
So if i ever wanted to restore the entire share it wouldn't show all the files unless i press a button that i don't known i need to press because i haven't been told that the folder contains more than 10.000 files/folder ?
Have nice day,
Henrik

Dima P.
Product Manager
Posts: 12746
Liked: 1206 times
Joined: Feb 04, 2013 2:07 pm
Full Name: Dmitry Popov
Location: Prague
Contact:

Re: Get-VBRNASBackupFLRItem returning different number of files on same restore point

Post by Dima P. » 1 person likes this post

Henrik,
shouldn't the documentation then say that it will return a random number if the folder contains more than 10.000(or the hidden value in registry)?
We will ask TW to add a note, thanks!
Are you saying that the UI also will show a wrong number of files without any warnings until you press a button ?
Backup browser will show first 1k objects and then will display a notification prompt to show all objects anyway.
i ever wanted to restore the entire share it wouldn't show all the files unless i press a button that i don't known i need to press because i haven't been told that the folder contains more than 10.000 files/folder ?
It happens:

- when you open the folder which contains more that 1k of objects
- when you search for an object and output contains more that 1k of object

If you want to restore entire share - you need to go directly to the entire file share restore wizard, if you need to restore a folder with 10k objects likely you will select entire folder and not 10k of child objects one by one :wink:

oleg.feoktistov
Veeam Software
Posts: 1013
Liked: 366 times
Joined: Sep 25, 2019 10:32 am
Full Name: Oleg Feoktistov
Contact:

Re: Get-VBRNASBackupFLRItem returning different number of files on same restore point

Post by oleg.feoktistov »

And here is the screenshot of the notification prompt Dmitry mentioned.
I do agree with you that we need such warning for Get-VBRNASBackupFLRItem along with -ShowAll parameter as I wrote earlier. Thanks!

Post Reply

Who is online

Users browsing this forum: No registered users and 10 guests