Hyper-V encountered an error while copying virtual hard disks to destination folder

Hyper-V shows this error when it cannot write a virtual hard disk (.vhd or .vhdx) to the destination during a move, an import or an export, and the usual fix is to correct the file permissions, merge leftover checkpoints and free space on the target drive before you retry.

The steps below cover Hyper-V Manager and PowerShell on Windows 11, Windows 10 and Windows Server, plus the related export error.

Hyper-V encountered an error while copying virtual hard disks to destination folder
Hyper-V Manager lists each virtual machine with its Checkpoints pane, where leftover checkpoints show before a move or export. (Image: Microsoft)

How to fix Hyper-V error while copying virtual hard disks

Work through these in order from an account in the local Administrators or Hyper-V Administrators group. Each step removes one documented cause.

  1. In Hyper-V Manager, select See details on the error and note the error code and the Virtual Machine ID it lists.
  2. Shut down the virtual machine. Shutting down also merges hidden differencing disks in many cases.
  3. Check the Checkpoints pane. Delete any checkpoint you no longer need so Hyper-V merges its .avhdx file into the parent disk.
  4. Check that the destination drive has more free space than the size of every .vhdx and .avhdx file in the virtual machine's folder.
  5. If the code is 0x80070005, grant the virtual machine's ID full control of the disk with icacls (command below).
  6. Close any program that has the .vhdx file open, such as a backup job or a disk mounted in File Explorer, then retry the move, import or export.
Fix Hyper-V error while copying virtual hard disks from the Move Wizard details
Open the error details to read each failed step and its error code before choosing a fix. (Image: Microsoft Q&A)

Hyper-V encountered an error while copying virtual hard disks to destination folder

Microsoft's Hyper-V storage troubleshooting guide lists the causes behind failed migration, export and import jobs. Match the code under See details to a group below.

General access denied error (0x80070005)

The Virtual Machine SID is missing from the permissions on the .vhd, .vhdx or .avhd file, or NTFS permissions on the folder are wrong.

  1. Copy the Virtual Machine ID from the error details.
  2. Open Command Prompt with Run as administrator.
  3. Run icacls "<path to disk>" /grant "NT VIRTUAL MACHINE\<Virtual Machine ID>":(F).
  4. Repeat for each .avhdx checkpoint file and for the configuration file if the error names it, then retry.

The process cannot access the file because it is being used by another process (0x80070020)

Another process holds the disk open, often a backup job that left a checkpoint behind.

  1. Let any running backup job finish, or stop it from the backup software.
  2. Run vssadmin list writers from an elevated Command Prompt and look for writers in a failed state.
  3. Restart the related services or the host to clear failed writers.
  4. Retry the copy.

The system cannot find the file specified (0x2)

A disk in the checkpoint chain is missing or the virtual machine points to a path that no longer exists.

  1. Open the virtual machine's Settings and select each hard drive to see the path it uses.
  2. Look in the disk folder for .avhdx files that Hyper-V Manager does not list.
  3. Merge orphaned .avhdx files into the parent with Edit Disk (steps below).
  4. Point the hard drive setting to the merged .vhdx, then retry.

The copy stops partway or the destination volume fills up

Large .avhdx checkpoint files take up more space than expected on the target drive.

  1. Delete checkpoints you no longer need so they merge into the parent disk.
  2. Free space on the destination drive, or choose a different destination.
  3. Retry the move.

Copy fails on a host with third-party antivirus

An antivirus filter driver blocks access to the disk files during the copy.

  1. Ask your antivirus vendor to apply Microsoft's recommended Hyper-V exclusions for .vhd, .vhdx, .avhd, .avhdx and .vmcx files and the vmms.exe and vmwp.exe processes.
  2. Microsoft notes that Microsoft Defender may not need extra exclusions, because it has automatic ones.
  3. Retry the copy.
Hyper-V error while moving virtual machine storage with details expanded
Expand the details to read the error code, here 0x80004005, and match it to the cause groups in this section. (Image: Microsoft Q&A)

Hyper-V virtual hard disk permissions fix with icacls

Every virtual machine has its own SID, shown as the Virtual Machine ID in the error. Hyper-V needs that SID on the disk file, so add it back after copying a disk by hand.

icacls "E:\VMs\VMName\Disk0.vhdx" /grant "NT VIRTUAL MACHINE\5FC5C385-BD98-451F-B3F3-1E50E06EE663":(F)

/grant adds a permission for the named account without removing existing ones. NT VIRTUAL MACHINE\<ID> is the virtual machine's own account, and (F) is full control. Replace the path and the ID with your own values.

You should see: The virtual machine then starts, or the move completes, without the 0x80070005 code.

If the error names the configuration file instead, run the same command against the virtual machine's .xml or .vmcx file. It also clears the access-denied fault behind the error applying hard drive changes.

How to merge Hyper-V checkpoints before copying a virtual hard disk

Checkpoints live as .avhdx files next to the .vhdx. Never delete an .avhdx file in File Explorer; delete the checkpoint in Hyper-V Manager so it merges first.

  1. In Hyper-V Manager, select the virtual machine.
  2. In the Checkpoints list, right-click the checkpoint and select Delete Checkpoint, or Delete Checkpoint Subtree to remove it and every later checkpoint.
  3. If those commands are missing, select the checkpoint and press Del.
  4. Confirm with Delete and wait for the merge to finish.
  5. For an .avhdx file that Hyper-V Manager does not list, select Actions > Edit Disk.
  6. On Locate Disk, select Browse, pick the .avhdx file, and select Next.
  7. On Choose Action, select Merge > To the parent virtual hard disk, then finish the wizard.

From PowerShell, Merge-VHD -Path <AVHDXPath> -DestinationPath <VHDXPath> merges a differencing disk into its parent. Back up the disk files before any manual merge.

Merge Hyper-V checkpoints with Delete Checkpoint in the Checkpoints pane
Delete Checkpoint Subtree removes the selected checkpoint and every later one, merging their .avhdx files. (Image: Microsoft)

Move Hyper-V virtual machine storage with PowerShell

When the Move wizard keeps failing, run the same move from PowerShell opened as administrator, where the error prints in the console.

  1. Run (Get-VM -Name "Test VM").HardDrives.Path to list every disk the virtual machine uses.
  2. Confirm that each listed file exists and that the destination drive has room for all of them.
  3. Run Move-VMStorage "Test VM" -DestinationStoragePath D:\TestVM to move every file of the virtual machine to D:\TestVM.
  4. Read any error the cmdlet prints and match its code to the groups above.
  5. Run the first command again to check that the paths now point to D:\TestVM.

In Hyper-V Manager, the same job runs from the virtual machine's right-click menu: select Move, then pick the type of move and the destination in the Move Wizard.

How to copy a Hyper-V VM

An export gathers the virtual hard disks, configuration files and checkpoint files into one folder. It works on a running or stopped virtual machine, and the import can then copy it to any folder.

  1. In Hyper-V Manager, right-click the virtual machine and select Export.
  2. Choose where to store the exported files and select Export.
  3. From the Actions menu, select Import Virtual Machine, then Next.
  4. Select the folder with the exported files and select Next.
  5. Select the virtual machine to import.
  6. Choose Copy the virtual machine to get a new unique ID, or Restore the virtual machine to keep the same ID, then select Next.
  7. Pick the destination folders for the files and select Finish.

PowerShell equivalents are Export-VM -Name <vm name> -Path <path> and Import-VM -Path '<export path>\<ID>.vmcx' -Copy -GenerateNewId. A Restore import needs the original virtual machine deleted first if it is still registered on the host.

Hyper-V error occurred while attempting to export the virtual machine

An export copies the same disk files, so it fails for the same reasons as a move. Imports add one more failure point: the configuration version.

Export fails with access denied

Permissions on the source disk or the export folder do not allow the copy.

  1. Check the error details for the file path and the Virtual Machine ID.
  2. Grant the virtual machine's SID full control of that file with icacls.
  3. Export to an empty folder on a local drive, then retry.

Export fails because the file is in use (0x80070020)

A backup job or a mounted disk holds the .vhdx open.

  1. Wait for backup jobs to finish and stagger schedules so they do not overlap.
  2. Eject the disk if it is mounted in File Explorer.
  3. Retry the export.

Hyper-V encountered an error during import

The virtual machine was created on a newer version of Hyper-V than the host you are importing to, or the export files are incomplete.

  1. Import onto a host that runs the same or a newer version of Hyper-V.
  2. Check that the export folder still holds the virtual hard disk, configuration and checkpoint files.
  3. Use Copy the virtual machine if the original virtual machine is still registered on the same host.
Hyper-V error occurred while attempting to export the virtual machine in Event Viewer
Hyper-V-VMMS event 18350 records an export that failed with Access is denied (0x80070005). (Image: Microsoft Q&A)

How to test a Hyper-V virtual hard disk after copying

Test-VHD -Path "D:\TestVM\Disk1.vhdx"

Test-VHD checks a virtual hard disk, and its whole differencing chain, for problems that would make it unusable. Point it at the copied file in the destination folder.

You should see: The cmdlet returns True when the disk is usable. False means the copy or its checkpoint chain is damaged, so copy it again from the source or restore from backup.

Hyper-V copy virtual hard disk error FAQ

How do I fix a Hyper-V error when copying virtual hard disks?

Open See details and read the error code. Access denied (0x80070005) needs the virtual machine's SID added with icacls, file in use (0x80070020) needs the locking job closed, and missing files need checkpoints merged before you retry.

How do I copy a Hyper-V VM?

Export it from Hyper-V Manager, then use Import Virtual Machine and choose Copy the virtual machine. That import type copies the files to a folder you pick and gives the copy a new unique ID, so it can sit on the same host as the original.

Can I copy a .vhdx file in File Explorer?

Yes, with the virtual machine shut down. If the virtual machine then reports access denied on the copied disk, add its SID with icacls, or use Export and Import, which gather the disks, checkpoints and configuration together.

Why does Hyper-V say access is denied on a virtual hard disk?

The disk file's permissions do not include the virtual machine's own SID. Microsoft's fix is to grant NT VIRTUAL MACHINE plus the Virtual Machine ID full control of the .vhd, .vhdx or .avhd file with icacls.

Can I delete .avhdx files to free space?

No. Microsoft says not to delete .avhdx files directly. Delete the checkpoint in Hyper-V Manager so Hyper-V merges the file into the parent disk, or merge an orphaned one with Edit Disk.

Why does a Hyper-V import fail on another PC?

You can only import a virtual machine if the host supports its configuration version. A virtual machine made on a newer version of Hyper-V will not import into an older one.

Do I need to shut down the VM to move its storage?

Not for an export, which Microsoft says works on a running or stopped virtual machine. Shutting down still helps when checkpoints need to merge, because differencing disks typically merge as part of the shutdown.

Philip Celasco

Philip is a Texas-based technology writer and IT administrator at Techdows.com with more than 10 years of experience creating practical content for everyday users and professionals. He specializes in web browsers, particularly Chromium-based platforms such as Google Chrome, Microsoft Edge, Brave, and Opera. Through his work as an IT administrator, Philip has hands-on experience managing devices, configuring browser policies, troubleshooting software and network issues, and helping people resolve problems that affect productivity and security. His articles are based on practical testing and real-world technical experience. He covers browser settings, extensions, performance problems, privacy controls, security features, and Windows troubleshooting. Outside work, Philip enjoys the quieter side of life in Texas and stepping away from the screen when he can. He has two kids, two cats and loves to play golf with his mother during the weekends.

Leave a Reply

Your email address will not be published. Required fields are marked *