Yes, I know, why not use Hyper-V console remove Virtual Machines?
Thanks for Jokelainen Jouni gave me this idea about create this script!
So as you know, when delete Virtual Machines from Hyper-V console, it left all the checkpoint hard disks and virtual hardisks behin. In a case, if you have lots of Hyper-V host, lots of Virtual Machines, it is pain in the ass to clean them up.
So I came up this simple powershell script. This script can be use only locally in a Hyper-V host, not remotely. And it need to be run as Administrator.
Inside the script, has a funtion call “Remove-MyLabVM”, you can just use the funtion if you don’t want use the powershell menu I made.
Just for fun, I also make a “Remove Virtual Machine” tool.
When use it locally, it need to be run as admin rights, and do not required input username and password.
When use it remotely, it can be run as normal user right, and it is need to input username and password that has admin rights for the remote Hyper-V host.
When use it remotely, it also required your firewall and winrm are configured as allowed, because it needs to run powershell remotely to another computer.
You can download it from GitHub: https://github.com/sandytsang/Hyper-V/tree/main/Remove%20Hyper-V%20VMs