select disk X (where X is the VHD's disk number) online disk attributes disk clear readonly This erases data but may salvage the VHD container:
clean convert mbr create partition primary format fs=ntfs quick assign letter=Z exit After this, the VHD is functional but empty. Use data recovery software on the original corrupted VHD before cleaning. When Microsoft tools fail, specialized software can reconstruct VHD headers, repair block maps, and extract data. how to repair vhd file
Open PowerShell as Administrator: