Restoring .vmdk files using powershell

PowerShell script exchange

Restoring .vmdk files using powershell

Veeam Logoby sbedford » Tue 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?
sbedford
Lurker
 
Posts: 1
Liked: never
Joined: Thu Dec 02, 2010 11:20 am
Full Name: Stephen Bedford

Re: Restoring .vmdk files using powershell

Veeam Logoby Alexey D. » Wed Dec 15, 2010 12:27 pm

Hello Stephen,

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

Re: Restoring .vmdk files using powershell

Veeam Logoby ToddWhitney » Thu 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?
ToddWhitney
Lurker
 
Posts: 1
Liked: never
Joined: Wed Jul 16, 2014 1:03 pm
Full Name: Todd Whitney

Re: Restoring .vmdk files using powershell

Veeam Logoby v.Eremin » Fri 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.
v.Eremin
Veeam Software
 
Posts: 13281
Liked: 970 times
Joined: Fri Oct 26, 2012 3:28 pm
Full Name: Vladimir Eremin

[MERGED] : Restoring .vmdk files to VMware Datastore

Veeam Logoby didi2102 » Wed 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
didi2102
Novice
 
Posts: 4
Liked: never
Joined: Thu Apr 15, 2010 1:13 pm
Full Name: LOUKA

Re: Restoring .vmdk files using powershell

Veeam Logoby v.Eremin » Thu 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.
v.Eremin
Veeam Software
 
Posts: 13281
Liked: 970 times
Joined: Fri Oct 26, 2012 3:28 pm
Full Name: Vladimir Eremin

Re: Restoring .vmdk files using powershell

Veeam Logoby didi2102 » Thu 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 !
didi2102
Novice
 
Posts: 4
Liked: never
Joined: Thu Apr 15, 2010 1:13 pm
Full Name: LOUKA

Re: Restoring .vmdk files using powershell

Veeam Logoby v.Eremin » Thu 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.
v.Eremin
Veeam Software
 
Posts: 13281
Liked: 970 times
Joined: Fri Oct 26, 2012 3:28 pm
Full Name: Vladimir Eremin

[MERGED] : VM File restore to different datastore

Veeam Logoby spectri » Fri 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 (powershell-f26/restoring-vmdk-files-using-powershell-t5883.html), it's not possible, but I'd love it if someone can confirm?
spectri
Lurker
 
Posts: 1
Liked: never
Joined: Thu Aug 28, 2014 1:09 pm
Full Name: Jake Ackman

Re: Restoring .vmdk files using powershell

Veeam Logoby v.Eremin » Mon 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.
v.Eremin
Veeam Software
 
Posts: 13281
Liked: 970 times
Joined: Fri Oct 26, 2012 3:28 pm
Full Name: Vladimir Eremin


Return to PowerShell



Who is online

Users browsing this forum: No registered users and 6 guests