DPM Scripted VM Recovery Fails (Error 104 0x80041002, 3111)

1 minute read

TL;WR: If you’re trying to use DPM to restore a copy of a protected hyper-v datasource to a folder instead of to a hypervisor (e.g. so that you can mount and examine the VHD) then you need to use -RecoveryLocation CopyToFolder -RecoveryType Restore.

-RecoveryType

Specifies the recovery type. If you specify the HyperVDatasource parameter, the only valid value is Recover. The acceptable values for this parameter are: Recover or Restore.

https://docs.microsoft.com/en-us/powershell/module/dataprotectionmanager/new-dpmrecoveryoption?view=systemcenter-ps-2019

The Microsoft documentation is flat out wrong. It very explicitly states that the only valid RecoveryType for HyperVDatasource is Recover. When trying to recover to an alternate disk location their example does not work. Based on the example script you would expect the code below to work. Instead if you try it you’ll get a powershell error stating "The recovery point location that you have passed is invalid. Please try again with a different value (ID:31050)."

$BadOption = New-DPMRecoveryOption -HyperVDatasource -TargetServer "target.contoso.com" -RecoveryLocation CopyToFolder -RecoveryType Recover -TargetLocation "D:\DestinationFolder"

So maybe instead of that you’d google around then try the following (obviously wrong) option AlternateHyperVServer out of desperation and it appears to work… At first.

$BadOption = New-DPMRecoveryOption -HyperVDatasource -TargetServer "target.contoso.com" -RecoveryLocation AlternateHyperVServer -RecoveryType Recover -TargetLocation "D:\DestinationFolder"

However at some point that job will fail with "An unexpected error occurred while the job was running. (ID 104 Details: Unknown error (0x80041002) (0x80041002))" which is entirely unhelpful. If you go to the job details you’ll get an equally unhelpful error 3111. Making some assumptions around that error code (WMI object not found error) I’m thinking that it’s trying to import the VM to a hyper-v instance running on that server. That doesn’t work if there’s no valid hypervisor running. Instead you need to user the parameters -RecoveryLocation CopyToFolder and -RecoveryType Restore.

$WorkingOption = New-DPMRecoveryOption -HyperVDatasource -TargetServer "target.contoso.com" -RecoveryLocation CopyToFolder -RecoveryType Restore -TargetLocation "D:\DestinationFolder"