Restore vmdk from cloud to specific VM on datastore

PowerShell script exchange

Restore vmdk from cloud to specific VM on datastore

Veeam Logoby claudio.rigolio » Wed Mar 15, 2017 9:10 am

Hi,
I'm writing a script for automatic restore of entire VMs from my cloud backup but I have some copy job only for single vmdk for space saving.
I can't figure out how to create restore procedure for theese vmk directly into VMs datastore position.

If I use the GUI it works correctly.

My script is this one:
Code: Select all
Add-PSSnapin -Name VeeamPSSnapIn -ErrorAction SilentlyContinue
Get-VBRBackupRepository -Name "NAME" | Sync-VBRBackupRepository
$lastdb1 = Get-VBRBackup -Name "DB1 Cloud" | Get-VBRRestorePoint -Name *DB1* | Select -Last 1
$drhost = Get-VBRServer -Name "IP-ADDRESS"
$drdatastore = Find-VBRViDatastore -Server $drhost -Name "DATASTORE-NAME"

$xmlpath = "<datacenterRef></datacenterRef><datacenterName></datacenterName><datacenterPath></datacenterPath><hostRef>HOST-IP</hostRef><datastoreRef>DATASTORE-GUID</datastoreRef><datastoreGuid>DATASTORE-GUID</datastoreGuid><FullName>[DRdatastore] DB1/TEST/DB1_4.vmdk</FullName>"

$virtualDisk = Get-VBRFilesInRestorePoint -RestorePoint $lastdb1 | where {$_.FileName -like “*DB1_4*”}

Start-VBRRestoreVMFiles –RestorePoint $lastdb1 –Server $drhost -path $xmlpath -Files $virtualDisk


What is the correct "-path" for Start-VBRRestoreVMFiles procedure?
Thanks in advanced for your help.
Bye

Claudio
claudio.rigolio
Novice
 
Posts: 3
Liked: never
Joined: Wed Mar 15, 2017 8:49 am
Full Name: Claudio Rigolio

Re: Restore vmdk from cloud to specific VM on datastore

Veeam Logoby v.Eremin » Wed Mar 15, 2017 6:20 pm

I'm not sure whether an XML path can be used as a target destination. You might want to try some local path first (such as D:\temp) to confirm this assumption. Thanks.
v.Eremin
Veeam Software
 
Posts: 13255
Liked: 966 times
Joined: Fri Oct 26, 2012 3:28 pm
Full Name: Vladimir Eremin

Re: Restore vmdk from cloud to specific VM on datastore

Veeam Logoby claudio.rigolio » Thu Mar 16, 2017 8:05 am

With local path it works correctly, but I need to write directly into my datastore, under VM folder, like the GUI does.
I tried with datastore path from vSphere Clinet like "[datastore]/APP1", or "/vmfs/volumes/577d00d0-0fe5abb0-9756-ac254f58df7c" but it doesn't work and it gives me an "XML path error", that's why I'm trying xml path.
I looked veeam logs and there I found the xml path that I'm trying to use.
claudio.rigolio
Novice
 
Posts: 3
Liked: never
Joined: Wed Mar 15, 2017 8:49 am
Full Name: Claudio Rigolio

Re: Restore vmdk from cloud to specific VM on datastore

Veeam Logoby v.Eremin » Thu Mar 16, 2017 11:26 am

Most likely, the said parameter expects a local path, not a path to a datastore. So, in your case, it should be two-step process: restore to local path and copy it later to datastore via copy utility. Thanks.
v.Eremin
Veeam Software
 
Posts: 13255
Liked: 966 times
Joined: Fri Oct 26, 2012 3:28 pm
Full Name: Vladimir Eremin

Re: Restore vmdk from cloud to specific VM on datastore

Veeam Logoby claudio.rigolio » Fri Mar 17, 2017 9:27 am

It means that the GUI does the direct restore to datastore but the powershell doesn't?
It's a bit strange....
I thought that all GUI procedures were powershell command...
Am I wrong?

Thanks
claudio.rigolio
Novice
 
Posts: 3
Liked: never
Joined: Wed Mar 15, 2017 8:49 am
Full Name: Claudio Rigolio

Re: Restore vmdk from cloud to specific VM on datastore

Veeam Logoby tsightler » Fri Mar 17, 2017 2:21 pm

The GUI is definitely not using Powershell behind the scenes. Our Powershell cmdlets are quite functional and provide probably 80-90% of the GUI functionality, but not quite everything.
tsightler
Veeam Software
 
Posts: 4765
Liked: 1737 times
Joined: Fri Jun 05, 2009 12:57 pm
Full Name: Tom Sightler


Return to PowerShell



Who is online

Users browsing this forum: No registered users and 11 guests