PowerShell script exchange
Post Reply
Bharathy
Novice
Posts: 7
Liked: never
Joined: Nov 17, 2021 1:03 pm
Full Name: Bharathy
Contact:

Script to list files and folders under the Storage in Veeam

Post by Bharathy »

Hello,

I need to know if it is possible list the files and folders located under the storage device in Veeam? In GUI, From the home screen -> Click 'Files' -> Under the 'EMC DataDomain' storage I can see the folders and files.

I need a script to list the files/folders from the storage irrespective of the backup jobs as I can in GUI. I assume there are lots of vbk files missing connection to veeam backup server. I need to clean them up.

Can someone help with it? Thanks!
Mildur
Product Manager
Posts: 9848
Liked: 2607 times
Joined: May 13, 2017 4:51 pm
Full Name: Fabian K.
Location: Switzerland
Contact:

Re: Script to list files and folders under the Storage in Veeam

Post by Mildur »

Hi Bharathy

For just listing the files (read Only), you can configure SMB access to the ddboost storage unit.
This will give you access to the folder structure.

I recommend to get our support involved, before deleting any orphaned backup files.

Thanks
Fabian
Product Management Analyst @ Veeam Software
david.domask
Veeam Software
Posts: 2123
Liked: 513 times
Joined: Jun 28, 2016 12:12 pm
Contact:

Re: Script to list files and folders under the Storage in Veeam

Post by david.domask »

Hey @Bharathy there aren't any built-in cmdlets to let you do this, so you have two options:

1. Go to the files tab and shift+click the files and copy them; this will actually grab the file names and you can copy them to notepad++ or some other editor: https://imgur.com/a/bPJZrhD (I do this with Storeonce, but it works for DDBoost also. Must be done from the VBR machine itself, not remote console)
2. You can use the method provided by Oleg here which includes unsupported methods. Please note Veeam Support cannot assist with unsupported .NET methods, but I've used this pretty reliably for other reasons: post373305.html#p373305

You will instead feed the method your DataDomain repository. I have some steps I wrote for an internal guide that I can share:
$repo = Get-VBRBackupRepository -name 'Name of your Storeonce Repository'
$Accessor = [Veeam.Backup.Core.CRepositoryAccessorFactory]::Create($repo)
$DirList = $Accessor.FileCommander.EnumItems($repo.Path)

The rest, read on!
TLDR Steps
Edit

If you're already a pro, then just do this:

Create the Accessor as above and ensure $DirList is Populated
Find your Backup Folder and save it to some variable, e.g., $BackupDirectory = $DirList | Where-Object{$_.Name -like 'name of the folder our VBK is in'}
Get the list of that Directory: $Backup2ImportDirList = $Accessor.FileCommander.EnumItems($BackupDirectory)
Get your VBK file: $BackupToImport = $Backup2ImportDirList | Where-Object {$_.Fullname -like "*.vbk"}
Import the VBK using native cmdlet: Import-VBRBackup -FileName $BackupToImport.FullName -Repository $repo
Once you have a list of the files and you find some you believe are not supposed to be there, please feel free to open a case; if you can tell from the foldeer name which job they likely belong to, please include job logs for that job for all time -- my guess is at some point retention was not allowed to delete the file, but we can check the logs for the file name in question and find out if there were issues with the delete request.
David Domask | Product Management: Principal Analyst
Bharathy
Novice
Posts: 7
Liked: never
Joined: Nov 17, 2021 1:03 pm
Full Name: Bharathy
Contact:

Re: Script to list files and folders under the Storage in Veeam

Post by Bharathy »

Hello David,

I tried the script and it worked for standalone repositories. But how do I use for scaleout repos.

When tried for scaleout repo, below error is seen.

PS C:\Windows\system32> $repo = Get-VBRBackupRepository -Scaleout -Name "Scaleout_repo_1"
$accessor = [Veeam.Backup.Core.CRepositoryAccessorFactory]::Create($repo)
Multiple ambiguous overloads found for "Create" and the argument count: "1".
At line:2 char:1
+ $accessor = [Veeam.Backup.Core.CRepositoryAccessorFactory]::Create($r ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : NotSpecified: (:) [], MethodException
+ FullyQualifiedErrorId : MethodCountCouldNotFindBest
david.domask
Veeam Software
Posts: 2123
Liked: 513 times
Joined: Jun 28, 2016 12:12 pm
Contact:

Re: Script to list files and folders under the Storage in Veeam

Post by david.domask »

Hi Bharathy!

Pass the extent directly. SOBR objects have an Extents property and you need to pass a repository object.
David Domask | Product Management: Principal Analyst
Post Reply

Who is online

Users browsing this forum: No registered users and 7 guests