PowerShell script exchange
Post Reply
dsATspace
Influencer
Posts: 19
Liked: never
Joined: Feb 28, 2022 9:09 am
Full Name: dennis
Contact:

Restore of Imported Backup FAIL

Post by dsATspace »

Hello,
I have imported a Backup from another Server

Code: Select all

$server = Get-VBRServer -Name "192.168.1.40"
Import-VBRBackup -Server 192.168.5.101 –FileName "E:\Backups\vm1\vm1.vbm"

PS C:\scripts> Get-VBRRestorePoint

VM Name              Creation Time           Type
-------                   -------------                 ----
vm1                    01.03.2022 15:29:42    Full
vm2                    28.02.2022 19:34:55    Full

When I try to restore this imported backup it fail

When Restore the local created backup "vm2" this works

Code: Select all

Restore Type       VM Name                 State      Start Time             End Time               Description
------------       -------              -----      ----------             --------               -----------
RestoreVm          vm2                        Stopped    01.03.2022 16:00:43    01.03.2022 16:03:02
What did I wrong ?

the Imported Backup: vm1 I can not restore.... it is the same command only vm1 insted of vm2

Start-VBRRestoreVM : Das Argument für den Parameter "RestorePoint" kann nicht überprüft werden. Das Argument ist NULL. Geben Sie einen gültigen Wert für das Argument an, und führen Sie den Befehl erneut aus.
In C:\scripts\vsss.ps1:16 Zeichen:34
+ Start-VBRRestoreVM –RestorePoint $restorepoint[1] –Server $server –Re ...
+ ~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidData: (:) [Start-VBRRestoreVM], ParameterBindingValidationException
+ FullyQualifiedErrorId : ParameterArgumentValidationError,Veeam.Backup.PowerShell.Cmdlets.StartVBRRestoreVM

When do the restore of the imported Backup in the GUI it works!



vsss.ps1

Code: Select all

Param(
    [String]$restorepointname = "HELP"       # VMName
    ,[String]$serverip = "HELP"              # vCenter IP
    ,[String]$rpoolname = "HELP"             # Destiation ResourcePool
    ,[String]$datastorename = "HELP"         # Destiation Datastore
    ,[String]$foldername = "HELP"            # Destiation Folder

)

$restorepoint = Get-VBRRestorePoint -Name $restorepointname
$server = Get-VBRServer -Name $serverip
$rpool = Find-VBRViResourcePool -Name $rpoolname -Server $server
$datastore = Find-VBRViDatastore -Name $datastorename -Server $server
$folder = Find-VBRViFolder -Name $foldername -Server $server

Start-VBRRestoreVM –RestorePoint $restorepoint[1] –Server $server –ResourcePool $rpool –Datastore $datastore –PowerUp $false
oleg.feoktistov
Veeam Software
Posts: 2010
Liked: 670 times
Joined: Sep 25, 2019 10:32 am
Full Name: Oleg Feoktistov
Contact:

Re: Restore of Imported Backup FAIL

Post by oleg.feoktistov »

Hi Dennis,

As I see in the error, you reference $restorepoint with index 1. So when you are reading just $restorepoint[1], do you see any output?

Thanks,
Oleg
dsATspace
Influencer
Posts: 19
Liked: never
Joined: Feb 28, 2022 9:09 am
Full Name: dennis
Contact:

Re: Restore of Imported Backup FAIL

Post by dsATspace »

Hi Oleg,
thanks a lot !

I removed the [1] in Start-VBRRestoreVM –RestorePoint $restorepoint[1] –Server $server –ResourcePool $rpool –Datastore $datastore –PowerUp $false

to

Start-VBRRestoreVM –RestorePoint $restorepoint –Server $server –ResourcePool $rpool –Datastore $datastore –PowerUp $false

Code: Select all


Restore Type       VM Name              State      Start Time             End Time               Description
------------       -------              -----      ----------             --------               -----------
RestoreVm          vm2   Stopped    02.03.2022 14:36:16    02.03.2022 14:38:36

But now I have the issue with restore of vm2


Start-VBRRestoreVM : "System.Object[]" kann nicht in den Typ "Veeam.Backup.Core.COib" konvertiert werden, der für den Parameter "RestorePoint" erforderlich ist. Die angegebene Methode wird nicht unterstützt.
In C:\scripts\vsss.ps1:16 Zeichen:34
+ Start-VBRRestoreVM –RestorePoint $restorepoint –Server $server –Resou ...
+ ~~~~~~~~~~~~~
+ CategoryInfo : InvalidArgument: (:) [Start-VBRRestoreVM], ParameterBindingException
+ FullyQualifiedErrorId : CannotConvertArgument,Veeam.Backup.PowerShell.Cmdlets.StartVBRRestoreVM

---

echo $restorepoint

give this output:

Code: Select all

VM Name                   Creation Time          Type
-------                   -------------          ----
vm2                     25.02.2022 13:30:42    Full
vm2                     25.02.2022 21:00:50    Increment
vm2                     27.02.2022 21:00:50    Increment
vm2                     28.02.2022 21:00:47    Increment
vm2                     01.03.2022 21:00:39    Increment
vm2                     25.02.2022 21:00:50    Increment
echo $restorepoint[1]

give this output:

Code: Select all

vm2        25.02.2022 21:00:50    Increment

--
by vm1

Code: Select all

echo $restorepoint

VM Name                   Creation Time          Type
-------                   -------------          ----
vm1                      01.03.2022 15:29:42    Full

echo $restorepoint[1]
is empty


----


Code: Select all

PS C:\scripts> Get-VBRRestorePoint -Name dev-la-Debian11-tst-DS

VM Name                   Creation Time          Type
-------                   -------------          ----
vm1    01.03.2022 15:29:42    Full


PS C:\scripts> Get-VBRRestorePoint -Name dev-la-Debian11-DS

VM Name                   Creation Time          Type
-------                   -------------          ----
vm2        25.02.2022 13:30:42    Full
vm2        25.02.2022 21:00:50    Increment
vm2        27.02.2022 21:00:50    Increment
vm2        28.02.2022 21:00:47    Increment
oleg.feoktistov
Veeam Software
Posts: 2010
Liked: 670 times
Joined: Sep 25, 2019 10:32 am
Full Name: Oleg Feoktistov
Contact:

Re: Restore of Imported Backup FAIL

Post by oleg.feoktistov »

Hi Dennis,

Thanks for the detailed response.
Can I ask you, please, to use </> label on preview stage for your posts to wrap code snippets and outputs in corresponding tags? Such division makes code look clearer and allows to seamlessly copy/paste script samples or errors to our labs to quickly test and compare results.

As for your issues, first about vm2 restore points. System.Object[] conversion error tells us that you are trying to pass an array of restore points to the restore cmdlet, and the cmdlet accepts only single one. So, you need to choose one restore point either by index (e.g. $restorepoint[1]) or any other criteria (e.g. $restorepoint | where {$_.CreationTIme -eq $time}).
Now, about vm1 restore points. As I can see from the $restorepoint output you shared, there is only one point for vm1. Hence, with $restorepoint[1] you are trying to get object by index, which is out of range. That's why it is empty. You should use $restorepoint[0] or simply $restorepoint instead.

Let me know how it goes.

Best regards,
Oleg
dsATspace
Influencer
Posts: 19
Liked: never
Joined: Feb 28, 2022 9:09 am
Full Name: dennis
Contact:

Re: Restore of Imported Backup FAIL

Post by dsATspace »

Hi,
thanks I found it

changed:

$restorepoint = Get-VBRRestorePoint -Name $restorepointname

to:

$restorepoint = Get-VBRRestorePoint -Name $restorepointname | Sort-Object –Property CreationTime –Descending | Select-Object -First 1


because vm1 had only one backup and vm2 had multible!

thanks for you help!

have a nice day!
Post Reply

Who is online

Users browsing this forum: No registered users and 13 guests