Not Found — Optimize-vhd

✅ Correct:

Get-Command optimize-vhd You should see: optimize-vhd not found

CommandType Name Version Source ----------- ---- ------- ------ Cmdlet Optimize-VHD 2.0.0.0 Hyper-V Then you can compact a VHD/VHDX: It is not available in all editions of

Install-WindowsFeature -Name RSAT-Hyper-V-Tools Sometimes the module exists but isn’t auto-loaded. Step-by-step fixes A

optimize-vhd -Path "D:\VMs\disk.vhdx" -Mode Full ❌ Incorrect (CMD):

Import-Module Hyper-V Check available Hyper-V commands:

Here’s a structured breakdown of why it happens and how to fix it. optimize-vhd is a PowerShell cmdlet used to compact or repair virtual hard disk (VHD/VHDX) files. It is not available in all editions of Windows — it’s part of the Hyper-V management tools. 2. Most likely causes | Symptom | Likely cause | |---------|--------------| | optimize-vhd : The term 'optimize-vhd' is not recognized | Hyper-V module not loaded or not installed | | Command works in PowerShell but not in CMD | It’s a PowerShell cmdlet, not an .exe | | Works on Server but not on Windows 10/11 Pro | Hyper-V management tools not enabled | 3. Step-by-step fixes A. Run in PowerShell, not Command Prompt optimize-vhd is not an executable — it’s a PowerShell cmdlet.