Friday, November 22, 2013

In Windows Server 2012 and Windows Server 2012 R2, we can remove a VM by Hyper-V Manager or PowerShell, "Remove-VM". However, it just deleted the VM and a configuration file of that VM. It hasn't deleted the related virtual hard disk files so we need to delete the virtual hard disk files by ourself. I intended to create a PowerShell script to remove VMs and related virtual hard disk files.Disclaimer: Make sure you do understand the script and test it in lab environment. You use this script at your own risk. If you don't understand what this script does, please don't use it in any environment.