PowerShell script exchange
Post Reply
sbedford
Lurker
Posts: 1
Liked: never
Joined: Dec 02, 2010 11:20 am
Full Name: Stephen Bedford

Restoring .vmdk files using powershell

Post by sbedford » Dec 14, 2010 4:22 pm

Hi,

I'm trying to restore a .vmdk file taken from a backup of a VM running on an esxi host and restore it onto a different esxi host using a powershell script. Doing this through the GUI works with no problems, but I'd like to let people run a powershell script instead of running through the wizard.

I think the problem I'm having is the location of where to restore the vmdk file to. The script I have so far is:

Code: Select all

$server = Get-VBRServer | where {$_.Name –eq “DESTINATION”}
$path = Find-VBRDatastore -Server ($server) | where {$_.Name -eq "DESTINATION DATASTORE"}
$FilesToRestore = Get-VBRFilesInRestorePoint -RestorePoint ($RestorePoint) | where {$_.FileName -eq server-flat.vmdk"}
Get-VBRBackup | where {$_.JobName -eq "BACKUP JOB NAME"} | Get-VBRRestorePoint | sort CreationTime -Descending | select -First 1 | Start-VBRRestoreVMFiles -Server ($server) -Path ($path) -Files ($FilesToRestore)
The output of this is:

Code: Select all

Restore Type       VM Name              State      Start Time             End Time               Initiator
------------       -------              -----      ----------             --------               ---------
RestoreVmFiles     VM-NAME            Stopped    14/12/2010 16:12:39    14/12/2010 16:12:46
The error message given in the GUI is:

Code: Select all

14/12/2010 16:08:54          Restore VM files started
14/12/2010 16:08:55 Fail     Data at the root level is invalid. Line 1, position 1.
                             Data at the root level is invalid. Line 1, position 1.
I've also tried setting the path to be similar to what the GUI gives as the Path when running through the wizard:

<datacenterRef>ha-datacenter</datacenterRef><hostRef>ha-host</hostRef><datastoreRef>4cf4e6db-b262b944-bf6f-00101870aa0e</datastoreRef><datastoreGuid>4cf4e6db-b262b944-bf6f-00101870aa0e</datastoreGuid><FullName>[DESTINATION DATASTORE] VM-NAME</FullName>

but I get the same as above in the GUI.

Any ideas what I'm doing wrong? How do you specify the location of a datastore to restore the files to?

Alexey D.

Re: Restoring .vmdk files using powershell

Post by Alexey D. » Dec 15, 2010 12:27 pm

Hello Stephen,

In its current version, Start-VBRRestoreVMFiles function can restore files to localhost only. Thanks!

ToddWhitney
Lurker
Posts: 1
Liked: never
Joined: Jul 16, 2014 1:03 pm
Full Name: Todd Whitney
Contact:

Re: Restoring .vmdk files using powershell

Post by ToddWhitney » Jul 17, 2014 8:53 pm

Does anyone know if this is still the case with the latest version of Veeam or does it allow you to restore to a ESXi datastore?

veremin
Product Manager
Posts: 16994
Liked: 1452 times
Joined: Oct 26, 2012 3:28 pm
Full Name: Vladimir Eremin
Contact:

Re: Restoring .vmdk files using powershell

Post by veremin » Jul 18, 2014 8:38 am

I believe the commandlet has been not changed since than. You still can just restore VM files either to local machine or to other Windows machine connected to backup console (-Server switch). Thanks.

didi2102
Novice
Posts: 4
Liked: never
Joined: Apr 15, 2010 1:13 pm
Full Name: LOUKA
Contact:

[MERGED] : Restoring .vmdk files to VMware Datastore

Post by didi2102 » Sep 24, 2014 4:46 pm

Hello everybody,
I'm looking the way to restore only VMDK files to a folder inside a VMware Datastore.
The problem is that I have to do this for several VM in one time and the GUI don't allow me to choose several VM but only one VM at a time (I've to restore 250 VMDK to my datastore)....
Please, is anybody knows a way to do that with PowerShell ?

Thank you for your help,

Didi

veremin
Product Manager
Posts: 16994
Liked: 1452 times
Joined: Oct 26, 2012 3:28 pm
Full Name: Vladimir Eremin
Contact:

Re: Restoring .vmdk files using powershell

Post by veremin » Sep 25, 2014 8:14 am

Hi Didi,

You can use Start-VBRRestoreVMFiles commandlet to restore VM files to localhost or other Win server you have in your environment and then copy those files either via File copy job or some copying tool.

Thanks.

didi2102
Novice
Posts: 4
Liked: never
Joined: Apr 15, 2010 1:13 pm
Full Name: LOUKA
Contact:

Re: Restoring .vmdk files using powershell

Post by didi2102 » Oct 23, 2014 3:27 pm

Hi v.Eremin,
Please, are you sure that it's not possible to give a VMFS datastore location with the -Path ?

Thanks !

veremin
Product Manager
Posts: 16994
Liked: 1452 times
Joined: Oct 26, 2012 3:28 pm
Full Name: Vladimir Eremin
Contact:

Re: Restoring .vmdk files using powershell

Post by veremin » Oct 23, 2014 4:02 pm

I believe that what's stated above still applies. At least, I've not been able to find a way to bypass that. Thanks.

spectri
Lurker
Posts: 1
Liked: never
Joined: Aug 28, 2014 1:09 pm
Full Name: Jake Ackman
Contact:

[MERGED] : VM File restore to different datastore

Post by spectri » Nov 28, 2014 6:47 pm

Hey all -

I'm fairly new to all this, but some forum posts suggest what I'm trying to do is impossible currently, which seems odd since you can do it quite easily with the GUI. I'm looking to restore VM files to a different datastore from the original, but it looks like the command I'm using only supports windows systems. (Start-VBRRestoreVMFiles). According to (http://forums.veeam.com/powershell-f26/ ... t5883.html), it's not possible, but I'd love it if someone can confirm?

veremin
Product Manager
Posts: 16994
Liked: 1452 times
Joined: Oct 26, 2012 3:28 pm
Full Name: Vladimir Eremin
Contact:

Re: Restoring .vmdk files using powershell

Post by veremin » Dec 01, 2014 9:15 am

Hi, Jake,

The situation is still the same. For now I can only think of splitting that process into two steps, like restoring files to Windows-based server first and, then, copying those files to the datastore via some copy tool.

Thanks.

Post Reply

Who is online

Users browsing this forum: No registered users and 7 guests