PowerShell script exchange
Post Reply
s.desbois
Novice
Posts: 8
Liked: 1 time
Joined: Aug 10, 2020 3:41 pm
Full Name: Sebastien Desbois
Contact:

Problem doing instant disk recovery with Powershell

Post by s.desbois »

Hello

I'm trying to automate Instant Disk Recovery with Powershell, and I have an issue with the documentation available.
https://helpcenter.veeam.com/docs/backu ... ml?ver=100
(Veeam 10.0.1.4854)

Example in https://helpcenter.veeam.com/docs/backu ... ml?ver=100

Code: Select all

$backup = Get-VBRBackup -Name "Winsrv4515"
$restorepoint = Get-VBRRestorePoint
$server = Get-VBRServer -Name "ESXiHost"
$vm = Find-VBRViEntity -Server $server -Name "Winsrv4515"
$device = Get-VBRViVirtualDevice -RestorePoint $restorepoint
Start-VBRViInstantVMDiskRecovery -RestorePoint $restorepoint[3] -TargetVM $vm -TargetVirtualDevice $device
When I try to get the VBRVIEntity for my VM, using the ESXi as server, I have no return.

Code: Select all

$server = Get-VBRServer  -Name "tc3-lab-esx03.hosts.vdclab"
Find-VBRViEntity -Server $server -Name "Test-Veeam-API-Restore"
If I try with the vCenter instead an ESXi, I have a return.

Code: Select all

$server = Get-VBRServer -Type VC -Name "vmwlab-tc3-vc01.vmwlab.local"
Find-VBRViEntity -Server $server -Name "Test-Veeam-API-Restore"


ConnHostId             : e5dac1d0-9491-4200-acc3-6c320ce2d971
Type                   : Vm
Reference              : vm-16053
Id                     : e5dac1d0-9491-4200-acc3-6c320ce2d971_vm-16053
Name                   : Test-Veeam-API-Restore
Path                   : vmwlab-tc3-vc01.vmwlab.local\TC3-Lab\TC3-Lab-Cluster\Test-Veeam-API-Restore
VmHostName             : tc3-lab-esx03.hosts.vdclab
VmFolderName           : Test-Env
IsLegacyFaultTolerance : False
FaultToleranceType     : None
GuestInfo              : Veeam.Backup.Model.CGuestInfo
Uuid                   : 4206e495-85d7-40a6-82ea-e4d703be0d3a
PowerState             : PoweredOn
IsTemplate             : False
ProvisionedSize        : 462886744864
UsedSize               : 462886743632
Platform               : EVmware
Problem is that if I launch the Instant Disk Recovery with the vCenter as "server", it will try to check if the vPower NFS datastore is mounted on the vCenter... And it will fail.

Code: Select all

Start-VBRViInstantVMDiskRecovery -RestorePoint $restorepointVM[0] -TargetVM $vm -TargetVirtualDevice $restoredisk
 Start-VBRViInstantVMDiskRecovery : There is no instant recovery session with ID '02e06ac7-0965-4c95-8db3-9e259f3c6be7'.
Au caractère Ligne:1 : 1
+ Start-VBRViInstantVMDiskRecovery -RestorePoint $restorepointVM[0] -Ta ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : NotSpecified: (:) [Start-VBRViInstantVMDiskRecovery], CAppException
    + FullyQualifiedErrorId : Veeam.Backup.Common.CAppException,Veeam.Backup.PowerShell.Cmdlets.StartVBRViInstantVMDiskRecovery 
Image

If I launch the Instant Disk Recovery through the Veeam Console, I can see that it will use the ESXi server...

Image


What I am missing / doing wrong?


PS: is there a way to do this through API? Didn't manage to find it in the doc.
oleg.feoktistov
Veeam Software
Posts: 1912
Liked: 635 times
Joined: Sep 25, 2019 10:32 am
Full Name: Oleg Feoktistov
Contact:

Re: Problem doing instant disk recovery with Powershell

Post by oleg.feoktistov »

Hi Sebastien,
When I try to get the VBRVIEntity for my VM, using the ESXi as server, I have no return.
It looks like Find-VBRViEntity doesn't allow you to return any resources within chosen ESXi if you added it to the VBR console under vCenter rather than as standalone host.

As for the disk restore issue, it appears to be a bug. At least, I do recall some investigation on that has been carried out a while ago.
I raised this question with QA internally. Let me get back to you with a more specific reply.

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

Re: Problem doing instant disk recovery with Powershell

Post by oleg.feoktistov » 2 people like this post

There is a bug, indeed, when it comes to exception handling. So, instead of the error you received, you should have seen 'Failed to publish VM..' in powershell.
Just to clarify, if you do instant disk restore with the same configs through UI, does it fail with the same error or succeed? Thanks!
s.desbois
Novice
Posts: 8
Liked: 1 time
Joined: Aug 10, 2020 3:41 pm
Full Name: Sebastien Desbois
Contact:

Re: Problem doing instant disk recovery with Powershell

Post by s.desbois »

Hello

We have no issue doing it through UI with the same settings.
oleg.feoktistov
Veeam Software
Posts: 1912
Liked: 635 times
Joined: Sep 25, 2019 10:32 am
Full Name: Oleg Feoktistov
Contact:

Re: Problem doing instant disk recovery with Powershell

Post by oleg.feoktistov »

Hi,

I cannot reproduce the same behaviour in our labs. The outcome is either "success" or "failed" for both methods.
I'd advice to reach our support to investigate deeper it involving logs check. Please share case id here for further follow-up.

Thanks,
Oleg
Post Reply

Who is online

Users browsing this forum: No registered users and 16 guests