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)
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
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.
<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?