-
- Enthusiast
- Posts: 41
- Liked: 4 times
- Joined: Mar 05, 2019 3:29 pm
- Full Name: Tim Lawhead
- Contact:
Enumerate files in a backup repository - with no backup job/.vbm file
Hello All,
I had a backup copy job that was deleted but the files are still on a HPE StoreOnce. VBR Forum Post
I found I can use the Files in the VBR client, go to the directory on the StoreOnce and delete the files, but I can't import them as a group.
Following the Get-VBRBAckupRepository Example 2, I was able to get 1 file from the folder in.
Since it looks like that method is only meant to be used with a direct file path and a wildcard can't be used to grab multiple files, what I'd like is to figure out a way to pull a list of all the .vbk/.vib files that exist in that directory and then use a Foreach loop with the Example 2 to import them.
I tried the File list from all repositories but it leaves out the folder that is missing the .vbm and doesn't show as imported when I rescan the repo.
Any suggestions are appreciated. TIA
I had a backup copy job that was deleted but the files are still on a HPE StoreOnce. VBR Forum Post
I found I can use the Files in the VBR client, go to the directory on the StoreOnce and delete the files, but I can't import them as a group.
Following the Get-VBRBAckupRepository Example 2, I was able to get 1 file from the folder in.
Since it looks like that method is only meant to be used with a direct file path and a wildcard can't be used to grab multiple files, what I'd like is to figure out a way to pull a list of all the .vbk/.vib files that exist in that directory and then use a Foreach loop with the Example 2 to import them.
I tried the File list from all repositories but it leaves out the folder that is missing the .vbm and doesn't show as imported when I rescan the repo.
Any suggestions are appreciated. TIA
-
- Veeam Software
- Posts: 2010
- Liked: 670 times
- Joined: Sep 25, 2019 10:32 am
- Full Name: Oleg Feoktistov
- Contact:
Re: Enumerate files in a backup repository - with no backup job/.vbm file
Hi Tim,
Well, normally that would involve some cmdlets querying file tree structure on StoreOnce appliances.
But since we don’t have any, you could simulate "Files" pane browsing with .NET methods to get all backups and then import them by their direct links:
The code above, for instance, imports all .vbk files from all StoreOnce appliance folders.
Hope that helps you out!
Oleg
Well, normally that would involve some cmdlets querying file tree structure on StoreOnce appliances.
But since we don’t have any, you could simulate "Files" pane browsing with .NET methods to get all backups and then import them by their direct links:
Code: Select all
asnp VeeamPSSnapin
$repository = Get-VBRBackupRepository | where {$_.Type -eq 'HPStoreOnceIntegration'}
$accessor = [Veeam.Backup.Core.CRepositoryAccessorFactory]::Create($repository)
$items = $accessor.FileCommander.EnumItems($repository.Path)
$fulls = @()
foreach ($item in $items) {
$folder = $repository.FriendlyPath + $item.Name
$backups = $accessor.FileCommander.EnumItems($folder)
foreach ($backup in $backups) {
if ($backup.Name -like '*vbk') {
$fulls += $backup
}
}
}
foreach ($full in $fulls) {
Import-VBRBackup -Repository $repository -FileName $full.FullName
}
Hope that helps you out!
Oleg
-
- Enthusiast
- Posts: 41
- Liked: 4 times
- Joined: Mar 05, 2019 3:29 pm
- Full Name: Tim Lawhead
- Contact:
Re: Enumerate files in a backup repository - with no backup job/.vbm file
Oleg,
Thank you for that pathway.
I am getting an error with the .NET call.
I did find a way that should work, but it will require more manual steps. Support pointed out that you can go to the Files section highlight the orphaned files in the HPE StoreOnce repository directory and copy/paste the names into a text file editor and then use those names in a PowerShell script to pull them in. For some reason, the console on my workstation in 9.5 U4 and now 10 CU2 won't let me copy and paste from the Files section into anything. After Support said that, I remoted into the the VBR server and using the console there it let me get the file names via Copy/Paste. Not sure what the issue is my my workstation console, but it was something I tried to do back in the beginning of this issue and was disappointed it wasn't a feature...only to find out later it is and there's a bug with my workstation.
I like the idea of handling the import all via a script and have little experience with the .NET methods. A quick search didn't turn up any documentation for Veeam .NET scripts or Veeam .NET methods. Any suggestions on how/where to learn these?
Thank you for that pathway.
I am getting an error with the .NET call.
Code: Select all
PS C:\> [Veeam.Backup.Core.CRepositoryAccessorFactory]
IsPublic IsSerial Name BaseType
-------- -------- ---- --------
True False CRepositoryAccessorFactory System.Object
PS C:\> [Veeam.Backup.Core.CRepositoryAccessorFactory]::Create($repository)
Cannot find an overload for "Create" and the argument count: "1".
At line:1 char:1
+ [Veeam.Backup.Core.CRepositoryAccessorFactory]::Create($repository)
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : NotSpecified: (:) [], MethodException
+ FullyQualifiedErrorId : MethodCountCouldNotFindBest
I like the idea of handling the import all via a script and have little experience with the .NET methods. A quick search didn't turn up any documentation for Veeam .NET scripts or Veeam .NET methods. Any suggestions on how/where to learn these?
-
- Veeam Vanguard
- Posts: 282
- Liked: 113 times
- Joined: Apr 20, 2017 4:19 pm
- Full Name: Joe Houghes
- Location: Castle Rock, CO
- Contact:
Re: Enumerate files in a backup repository - with no backup job/.vbm file
You won't find much specific around Veeam for the .NET types/methods, as it is unsupported & undocumented, and most users don't need functionality beyond the native PowerShell cmdlets.
I've got code and a demo of exporting details of the Veeam types & methods in my upcoming VeeamON session, as the session is focused around a PowerShell deep dive for reporting & configuration. Even my demos & code do not cover details about how to use the methods, since that requires understanding more advanced PowerShell, sometimes some .NET, and working with overloads.
Plus, since it's all core PowerShell functionality and understanding .NET, there is lots of documentation around how to work with it online.
I've got code and a demo of exporting details of the Veeam types & methods in my upcoming VeeamON session, as the session is focused around a PowerShell deep dive for reporting & configuration. Even my demos & code do not cover details about how to use the methods, since that requires understanding more advanced PowerShell, sometimes some .NET, and working with overloads.
Plus, since it's all core PowerShell functionality and understanding .NET, there is lots of documentation around how to work with it online.
Husband, Father, Solutions Architect, Geek | @DenverVMUG & @DenverPSUG leader | International Speaker | Veeam Vanguard | vExpert (PRO) | Cisco Champion
-
- Veeam Software
- Posts: 2010
- Liked: 670 times
- Joined: Sep 25, 2019 10:32 am
- Full Name: Oleg Feoktistov
- Contact:
Re: Enumerate files in a backup repository - with no backup job/.vbm file
Hey Tim,
Make sure to pass exactly one StoreOnce repository to the method arguments.
Thanks!
Code: Select all
[Veeam.Backup.Core.CRepositoryAccessorFactory]::Create($repository)
Cannot find an overload for "Create" and the argument count: "1".
At line:1 char:1
+ [Veeam.Backup.Core.CRepositoryAccessorFactory]::Create($repository)
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : NotSpecified: (:) [], MethodException
+ FullyQualifiedErrorId : MethodCountCouldNotFindBest
Thanks!
-
- Enthusiast
- Posts: 41
- Liked: 4 times
- Joined: Mar 05, 2019 3:29 pm
- Full Name: Tim Lawhead
- Contact:
Re: Enumerate files in a backup repository - with no backup job/.vbm file
I got a PM asking if I worked this out... No I didn't. My orphaned files passed their retention time and no restore was needed during that time frame.
Support pointed out that you can go to the orphaned job folder in the Files section of the VB&R client, select the files you want to import for restoration purposes and then right-click and hit copy and then you can paste out the file names/data into notepad or the like and parse out the file names and then do your PowerShell import with the file names.
I was having a problem with my client on my workstation doing the copy/paste and noted it to them, but at the time was able to go to the Veeam B&R server and do the copy/paste from the client on it.... since then I upgraded to Veeam 10 Cumulative Patch 2 and I just checked for the person that PM'd me and now the copy/paste isn't working on either my workstation or directly on the B&R server. This would be a new ticket to get sorted, but hopefully it's just me.
Support pointed out that you can go to the orphaned job folder in the Files section of the VB&R client, select the files you want to import for restoration purposes and then right-click and hit copy and then you can paste out the file names/data into notepad or the like and parse out the file names and then do your PowerShell import with the file names.
I was having a problem with my client on my workstation doing the copy/paste and noted it to them, but at the time was able to go to the Veeam B&R server and do the copy/paste from the client on it.... since then I upgraded to Veeam 10 Cumulative Patch 2 and I just checked for the person that PM'd me and now the copy/paste isn't working on either my workstation or directly on the B&R server. This would be a new ticket to get sorted, but hopefully it's just me.
-
- Veeam Software
- Posts: 2010
- Liked: 670 times
- Joined: Sep 25, 2019 10:32 am
- Full Name: Oleg Feoktistov
- Contact:
Re: Enumerate files in a backup repository - with no backup job/.vbm file
Hi Tim,
Have you sorted this out through support channel?
Do you need any help in regards to powershell?
Thanks,
Oleg
Have you sorted this out through support channel?
Do you need any help in regards to powershell?
Thanks,
Oleg
Who is online
Users browsing this forum: No registered users and 4 guests