Error: Failed to register VM (from scripted restore)

PowerShell script exchange

Error: Failed to register VM (from scripted restore)

Veeam Logoby DavidCole » Mon May 06, 2013 6:46 pm

Now that I have been put on the right track for getting my script to know what VMs are available to be restored I have found a new problem. The VM fails to register. The full error is:

Failed to register VM, configFile '[datastore] ServerName/ServerName.vmx', name 'ServerName', isTemplate 'False', poolRef '', hostRef 'host-83', folderRef 'group-v22'
The object has already been deleted or has not been completely created


When I do the same restore from the GUI it works fine, so I'm suspecting there is something somewhat obvious I'm missing. I did a couple of searches in the forum and didn't see a similar error except when folks were changing versions of ESXi, which I'm not doing.

Here's my script as it stands
Code: Select all
Add-PSSnapin -Name VeeamPSSnapin

# Set your variables like a good boy
$sRestoreDatastore = ""
$sRestoreHostFullName = ""
$sRestorePoint = ""
$sRestoreReason = ""
$sRestoreServer = ""
$sVM = ""

# First remind Veeam what is there to be restored
Get-VBRBackupRepository -Name Veeam | Sync-VBRBackupRepository

# Set the variables
$sRestoreVMName = "VM_Name"
$sRestoreHost = "Host_Name"
$sRestoreResourcePool = "Production"
$sRestoreDatastoreName = "Datastore_Name"

# Now get the details that Veeam needs
$sRestorePoint = Get-VBRRestorePoint –Backup(Get-VBRBackup) –Name $sRestoreVMName | select –Last 1
$sRestoreServer = Get-VBRServer -Name $sRestoreHost
$sRestoreDatastore = Find-VBRViDatastore -Server $sRestoreServer -Name $sRestoreDatastoreName

# and now do the restore   
Start-VBRRestoreVM -RestorePoint $sRestorePoint -Server $sRestoreServer   `
   -Datastore $sRestoreDatastore -ResourcePool $sRestoreResourcePool `
   -VMName $sRestoreVMName -Reason "Scripted restore" -PowerUp:$False


Does anyone have any suggestions for solutions or troubleshooting?

Best regards,

D
DavidCole
Novice
 
Posts: 4
Liked: never
Joined: Tue Nov 06, 2012 9:52 pm
Full Name: David Cole

Re: Error: Failed to register VM (from scripted restore)

Veeam Logoby tsightler » Mon May 06, 2013 7:18 pm

One thing that jumps out to me, the "-ResourcePool" option does not take a string, but rather needs a resource pool object located with Find-VBRViResourcePool so you might try the following changes to your script:

Code: Select all
# Set the variables
$sRestoreVMName = "VM_Name"
$sRestoreHost = "Host_Name"
$sRestoreResourcePoolName = "Production"
$sRestoreDatastoreName = "Datastore_Name"

# Now get the details that Veeam needs
$sRestorePoint = Get-VBRRestorePoint –Backup(Get-VBRBackup) –Name $sRestoreVMName | select –Last 1
$sRestoreServer = Get-VBRServer -Name $sRestoreHost
$sRestoreDatastore = Find-VBRViDatastore -Server $sRestoreServer -Name $sRestoreDatastoreName
$sRestoreResourcePool = Find-VBRViResourcePool -Server $sRestoreServer -Name $sRestoreResourcePoolName

# and now do the restore   
Start-VBRRestoreVM -RestorePoint $sRestorePoint -Server $sRestoreServer   `
   -Datastore $sRestoreDatastore -ResourcePool $sRestoreResourcePool `
   -VMName $sRestoreVMName -Reason "Scripted restore" -PowerUp:$False
tsightler
Veeam Software
 
Posts: 4768
Liked: 1737 times
Joined: Fri Jun 05, 2009 12:57 pm
Full Name: Tom Sightler

Re: Error: Failed to register VM (from scripted restore)

Veeam Logoby v.Eremin » Tue May 07, 2013 9:09 am

Just a little note - please be aware that Find-VBRViResourcePool doesn’t seem to work in case of vCenter. That’s to say, if you tried to specify you vCenter as a “–server” parameter, the abovementioned method wouldn’t find any. So, it’s a host that needs to be specified.

Thanks.
v.Eremin
Veeam Software
 
Posts: 13266
Liked: 968 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 3 guests