Files
docs/operations/reference/Powershell/Hyper V/Delete Locked VHDX File.md
Nicole Rappe daf24d7480
All checks were successful
GitOps Automatic Documentation Deployment / Sync Docs to https://kb.bunny-lab.io (push) Successful in 5s
GitOps Automatic Documentation Deployment / Sync Docs to https://docs.bunny-lab.io (push) Successful in 7s
Mass-File and Folder Renaming
2026-02-24 20:26:52 -07:00

506 B

tags
tags
PowerShell
Scripting

Purpose: You may find that you cannot delete a VHDX file for a virtual machine you removed from Hyper-V and/or Hyper-V Failover Cluster, and either cannot afford to, or do not want to reboot your virtualization host(s) to unlock the file locked by SYSTEM.

Run the following commands to unlock the file and delete it:

Dismount-VHD -Path "C:\Path\To\Disk.vhdx" -ErrorAction SilentlyContinue
Remove-Item -Path "C:\Path\To\Disk.vhdx" -Force