Creating VBM from scratch

PowerShell script exchange

Re: Creating VBM from scratch

Veeam Logoby warpconduit » Sun Jul 19, 2015 9:07 pm 1 person likes this post

I wanted to add a note as to what steps worked for me on Veeam Backup & Replication version 8 when transforms were failing and I needed to remove all VRBs and VIBs from a backup to free disk space:

  1. Open Veeam, go to Backups > Disk, right-click on the backup and select "Remove from backups" (leaves the files on disk)
  2. Use Windows Explorer to navigate to the backup's repository on disk, delete all files except your most recent VBK
  3. Return to Veeam, right-click on Backups and select "Import backup..." and import the VBK
  4. From the Veeam main menu select PowerShell
    Note: If you don't have the PowerShell menu item then you need to install the Veeam PowerShell module from your installation media (X:\Backup\BPS_x64.msi)
  5. Issue the following commands, replacing OriginalName with your original backup name:
    Code: Select all
    $BackupName = "OriginalName"
    $Backup = Get-VBRBackup -Name ($BackupName + "_imported")
    $Job = Get-VBRJob -Name "$BackupName"
    $Backup.Update($Job)
  6. Return to Backups in Veeam and you should see the backup renamed and no longer in the "imported" section
  7. Now, edit the associated job, go to the Storage section and re-map it to the backup, Finish to save changes

After these steps I ran the backup job and it created a new VIB and then transformed a new VBK & VRB without any issues (I'm using Incremental backup mode with periodic synthetic fulls). Hope it helps someone else.
warpconduit
Lurker
 
Posts: 1
Liked: 1 time
Joined: Sun Jul 19, 2015 1:40 am
Full Name: Josh Hartman

Re: Creating VBM from scratch

Veeam Logoby Brad.Morris » Wed Feb 17, 2016 10:39 pm

Hi there,

I have not had any luck with any of the scripts listed here :(

I am running V8 Update 3.

Can someone post a working script that will create a VBM file from imported VBK files please.
Brad.Morris
Enthusiast
 
Posts: 43
Liked: 2 times
Joined: Mon Sep 01, 2014 10:29 pm
Location: Melbourne, Australia
Full Name: Brad Morris

Re: Creating VBM from scratch

Veeam Logoby albertwt » Thu Jun 30, 2016 11:34 pm 1 person likes this post

This is the updated Powershell script that I have been given during my past interaction with the support team:

Code: Select all
#   [Veeam.Backup.Core.CCredentilasStroreInitializer]::InitLocal() to work with Lin repository

$backupName = Read-Host "Enter backup name for meta regeneration"

Add-Type -Path "C:\Program Files\Veeam\Backup and Replication\Backup\Veeam.Backup.Core.dll"
[Veeam.Backup.Common.LogFactory]::InitializeConsoleLog()

Try
{
   $backup = [Veeam.Backup.Core.CBackup]::GetAll() | Where { $_.Name.Equals($backupName) } | Select -index 0

    if ($backup -eq $null) {
        throw ("There is no backup with specified name : " + $backupName)
    }
   $storageAccessor = [Veeam.Backup.Core.CStorageAccessorFactory]::Create($backup)

   [Veeam.Backup.Core.CCredentilasStroreInitializer]::InitLocal()
   
   $metaUpdater = New-Object Veeam.Backup.Core.CSimpleBackupMetaUpdater
   $metaEx = new-object Veeam.Backup.Core.CBackupMetaEx -ArgumentList $backup, $storageAccessor, $metaUpdater
   $metaEx.GenerateAndSave()

   $metaFilePath = $backup.GetMetaFilePath($storageAccessor.FileCommander)
   Write-Host "Successfully saved meta for backup $($backupName) on $($storageAccessor.Name) : $($metaFilePath)"
}
Catch
{
   Write-Host $_.Exception.Message
   Write-Host $_.Exception.StackTrace
   Write-Host $_.Exception.InnerException.Message
   Write-Host $_.Exception.InnerException.StackTrace
   Break
}

$Reader = [System.IO.StreamReader] $metaFilePath
$MyString = $Reader.ReadToEnd();
$Reader.Dispose();


$removeString = 'LinkId="00000000-0000-0000-0000-000000000000"';
$index = $MyString.IndexOf($removeString);
$lengh = $removeString.Length;

$start = $MyString.Substring(0, $index);
$end  = $MyString.Substring($index + $lengh);

$clean = $start + $end;



$writer = [System.IO.StreamWriter] $metaFilePath
$writer.WriteLine($clean);
$writer.Close();


It must be executed from the Veeam Powershell console.

Hope that helps.
--
/* Veeam software enthusiast user & supporter ! */
albertwt
Expert
 
Posts: 607
Liked: 19 times
Joined: Thu Nov 05, 2009 12:24 pm
Location: Sydney, NSW

Re: Creating VBM from scratch

Veeam Logoby v.Eremin » Fri Jul 01, 2016 9:14 am 1 person likes this post

For all new-comers, kindly, leverage the said script only cautiously and reach support team for assistance, if you don't feel confident in scripting. Thanks.
v.Eremin
Veeam Software
 
Posts: 13291
Liked: 973 times
Joined: Fri Oct 26, 2012 3:28 pm
Full Name: Vladimir Eremin

Re: Creating VBM from scratch

Veeam Logoby albertwt » Mon Jul 11, 2016 7:18 am

v.Eremin wrote:For all new-comers, kindly, leverage the said script only cautiously and reach support team for assistance, if you don't feel confident in scripting. Thanks.


Yes, I agree.
Better off let the Support team assist you in running this script.

In my ase, running PowerShell script above still not resolving my issue in recreating the .VBM file.
--
/* Veeam software enthusiast user & supporter ! */
albertwt
Expert
 
Posts: 607
Liked: 19 times
Joined: Thu Nov 05, 2009 12:24 pm
Location: Sydney, NSW

Re: Creating VBM from scratch

Veeam Logoby reaperhammer » Thu Aug 18, 2016 10:44 pm 1 person likes this post

I tested the script from here in Veeam 9 u1 and it works, some additional information is required to know how to use it though. Also I noticed Veeam 9 u1 has the feature that if you just place a VBK in a folder with VIB/VRB files when you use the import function in the GUI and import the VBK it adds the incremental files as available restore points in the imported backup (even if a part of the chain is missing), so manually creating a VBM files is not actually required anymore :D

But just for the hell of it;

# Tested on Veeam 9 u1
# Step1 Place VRB/VIB files with VBK in same dir, import the VBK file into Veeam using Veeam's import function in the gui, note down the name of the imported backup
# Step2 set powershell executionpolicy to unrestricted and execute the script, when prompted enter the name of backup job for example, Enter backup name for meta regeneration: Backup Job 5_imported
# Step3 VBM file is created in the dir with VBK/VRB/VIB files and those restore points now show in Veeam now


Here is the output of a successful VBM creation:
Enter backup name for meta regeneration: Backup Job 5_imported

Code: Select all
===================================================================
Starting new log
Log has been started by 'x\administrator' user (Interactive)
Logging level: [4 (AboveNormal)]
MachineName: [BACKUP01], OS: [Microsoft Windows Server 2008 R2 Enterprise (6.1.7601) Service Pack 1], CPU: [16]
Process: [64 bit], PID: [8492], SessionId: [6]
UTC Time: [18/08/2016 10:31:11 p.m.], DaylightSavingTime: [False]
Culture: [en-NZ], UI culture: [en-US]
CmdLineParams: []
Network Interface, Name: Local Area Connection 2, Description: LAN, Interface Type: Ethernet, Operational Status: Up;
        Unicast IPAddresses: 192.168.1.17;
        Gateway IPAddresses: 192.168.1.251;
Network Interface, Name: Local Area Connection* 9, Description: Microsoft Failover Cluster Virtual Adapter, Interface Ty
pe: Ethernet, Operational Status: Down;
        Unicast IPAddresses: fe80::3c9d:88f:448e:9ba6%18; 169.254.155.166;
Network Interface, Name: SAN 18, Description: Broadcom BCM5709C NetXtreme II GigE (NDIS VBD Client) #48, Interface Type:
 Ethernet, Operational Status: Up;
        Unicast IPAddresses: 172.18.0.9;
Network Interface, Name: SAN 16, Description: Broadcom BCM5709C NetXtreme II GigE (NDIS VBD Client) #47, Interface Type:
 Ethernet, Operational Status: Up;
        Unicast IPAddresses: 172.16.0.9;
Network Interface, Name: Loopback Pseudo-Interface 1, Description: Software Loopback Interface 1, Interface Type: Loopba
ck, Operational Status: Up;
        Unicast IPAddresses: ::1; 127.0.0.1;
Network Interface, Name: isatap.{5031CEB0-A8E6-4614-A57B-E0FC9FE0818B}, Description: Microsoft ISATAP Adapter, Interface
 Type: Tunnel, Operational Status: Down;
        Unicast IPAddresses: fe80::5efe:169.254.155.166%20;
Network Interface, Name: isatap.{E6410A31-4102-40EF-B2EC-41B76D622AE3}, Description: Microsoft ISATAP Adapter #2, Interf
ace Type: Tunnel, Operational Status: Down;
        Unicast IPAddresses: fe80::5efe:172.16.0.9%19;
Network Interface, Name: isatap.{FF30153B-39EB-47A6-8DDB-24DEB3445A19}, Description: Microsoft ISATAP Adapter #3, Interf
ace Type: Tunnel, Operational Status: Down;
        Unicast IPAddresses: fe80::5efe:172.18.0.9%13;
Network Interface, Name: isatap.{24D130FF-E783-4731-A60E-8BDC6A49D020}, Description: Microsoft ISATAP Adapter #4, Interf
ace Type: Tunnel, Operational Status: Down;
        Unicast IPAddresses: fe80::5efe:192.168.1.17%15;
Network Interface, Name: Teredo Tunneling Pseudo-Interface, Description: Teredo Tunneling Pseudo-Interface, Interface Ty
pe: Tunnel, Operational Status: Down;
        Unicast IPAddresses: fe80::100:7f:fffe%21;
UTC offset: 12.00 hours

[19.08.2016 10:31:11] <26> Info     [BackupMeta] Generate backup meta for 'Backup Job 5_imported:f88f4208-1d07-40a9-94e6
-e04bd3d97a38'
[19.08.2016 10:31:11] <26> Info     [BackupMeta] Backup meta for 'Backup Job 5_imported:f88f4208-1d07-40a9-94e6-e04bd3d9
7a38' doesn't exist yet
[19.08.2016 10:31:11] <26> Info     Remoting options: []
[19.08.2016 10:31:11] <26> Info     Registering TCP client channel [bstcp]
[19.08.2016 10:31:11] <26> Info     [BACKUP01.x.local] Identity for impersonation is not specified.
[19.08.2016 10:31:11] <26> Info     [BACKUP01.x.local] Creating File Commander.
[19.08.2016 10:31:11] <26> Info     [Backup] SetBackupMetaFilePath, id 'f88f4208-1d07-40a9-94e6-e04bd3d97a38', backupMet
aFilePath '':'\\192.168.0.21\veeam\Backup Job 5-old\new\\Backup Job 5.vbm'
[19.08.2016 10:31:11] <26> Info     [BackupMetaUpdater] Generating backup meta in current thread
[19.08.2016 10:31:12] <26> Info     [BackupMeta] Serializing meta for backup Backup Job 5_imported
[19.08.2016 10:31:12] <26> Info     [BackupMeta] Serialization finished
[19.08.2016 10:31:12] <26> Info     [BackupMeta] Saving backup meta to '\\192.168.0.21\veeam\Backup Job 5-old\new\Backup
 Job 5.vbm'
[19.08.2016 10:31:12] <26> Info           [BACKUP01.x.local] [FC] Saving file content [<?xml version="1.0" encodin
g="UTF-8"?><BackupMeta Version="1" OriginalBackupId="f88f4208-1d07-40a9-94e6-e04bd3d97a38"><VmObjects><VmId><string>fc44
c23f-6ed2-4bea-bd58-a3b2118eaa39</string><string>ca014512-ae2b-4f17-85ce-b1d806e27f49</string></VmId></VmObjects><KeySet
s /><Vbm KeySetId="">&lt;?xml version="1.0" encoding="UTF-8"?&gt;&lt;Vbm Id="b5eb2782-69a8-42ab-9b7d-b83e4dd81526" JobId
="00000000-0000-0000-0000-000000000000" JobName="Backup Job 5_imported" JobType="Backup
[19.08.2016 10:31:12] <26> Info     [BACKUP01.x.local] [FC] Renaming remote file from [\\192.168.0.21\veeam\Backup
 Job 5-old\new\Backup Job 5.vbm_1_tmp] to [\\192.168.0.21\veeam\Backup Job 5-old\new\Backup Job 5.vbm]
[19.08.2016 10:31:12] <26> Info     [Backup] SetMetaUpdateTimeAndVersion, old value: [1/01/1753 12:00:00 a.m.,-1] new va
lue: [19/08/2016 10:31:12 a.m.,1]
[19.08.2016 10:31:12] <26> Info     [BackupMeta] Backup meta for 'Backup Job 5_imported:f88f4208-1d07-40a9-94e6-e04bd3d9
7a38' generated
Successfully saved meta for backup Backup Job 5_imported on BACKUP01.x.local : \\192.168.0.21\veeam\Backup Job 5-o
ld\new\Backup Job 5.vbm
PS N:\Backup Job 5-old\new>
reaperhammer
Novice
 
Posts: 7
Liked: 2 times
Joined: Thu Aug 18, 2016 7:59 pm
Full Name: Will S

[MERGED] Manually recreate .VBM file

Veeam Logoby mamosorre84 » Tue May 02, 2017 3:24 pm

Hello,
I have to recreate a .VBM file of my backup job.
Is this script valid for Veeam B&R version 9.5 Update 1?

$BackupName = "<Name of Imported Backup>"
$Backup = Get-VBRBackup -Name ($BackupName + "_imported")
$VBMFile = "$env:UserProfileDesktop" + "$BackupName" + ".vbm"
$Data = [Veeam.Backup.Core.CBackupMetaGenerator]::GenerateMeta($Backup)
$Data.Serialize() | Out-File $VBMFile
$xml = New-Object XML
$xml.Load($VBMFile)
$xml.BackupMeta.JobName = $BackupName
$xml.Save($VBMFile)
Remove-VBRBackup -Backup $Backup -Confirm:$false


I'm trying it but I'm receiving this error:

Cannot find an overload for "GenerateMeta" and the argument count: "1".
At line:1 char:1
+ $Data = [Veeam.Backup.Core.CBackupMetaGenerator]::GenerateMeta($Backup)
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : NotSpecified: (:) [], MethodException
+ FullyQualifiedErrorId : MethodCountCouldNotFindBest


Thank you,

Marco
mamosorre84
Enthusiast
 
Posts: 37
Liked: 5 times
Joined: Mon Oct 24, 2016 3:56 pm
Location: Ancona - Italy
Full Name: Marco Sorrentino

Re: Creating VBM from scratch

Veeam Logoby foggy » Tue May 02, 2017 4:50 pm

Hi Marco, please review this thread and contact support for assistance.
foggy
Veeam Software
 
Posts: 14752
Liked: 1083 times
Joined: Mon Jul 11, 2011 10:22 am
Full Name: Alexander Fogelson

Re: Creating VBM from scratch

Veeam Logoby adamjacques » Thu Jun 08, 2017 3:43 pm

Has anyone managed to do this in 9.5 update 2?
adamjacques
Service Provider
 
Posts: 1
Liked: never
Joined: Fri Aug 22, 2014 8:37 am
Full Name: Adam Jacques

Re: Creating VBM from scratch

Veeam Logoby v.Eremin » Fri Jun 09, 2017 6:21 pm

If the verified script exists, it will be support team that will have it. So, I'd ask them first. Thanks.
v.Eremin
Veeam Software
 
Posts: 13291
Liked: 973 times
Joined: Fri Oct 26, 2012 3:28 pm
Full Name: Vladimir Eremin

Previous

Return to PowerShell



Who is online

Users browsing this forum: No registered users and 2 guests