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
Thanks Sandy..i used to have billions of virtual machine leftovers from different kind of tests. Its pain to remove them because when created in a hurry, the virtual hard drives are not necessarily in same place with other machine files. Removing them manually is pain in the butt ……but not anymore 😀 😀
While this is kinda old, do you still have it published somewhere, see the link to TechNet is dead. Just heard about it via a Tweet and wanted to check it out for my lab where I am constantly creating and deleting VMs
Hi Andrew, it’s in Github https://github.com/sandytsang/Hyper-V/tree/main/Remove%20Hyper-V%20VMs
Thanks got it and used it. Very handy tool when creating and deleting VMs often
Hey Sandy. This script is no longer available on TechNet. Can you republish?
Oh, I should update this post. It’s in my Github now https://github.com/sandytsang/Hyper-V/tree/main/Remove%20Hyper-V%20VMs
You are welcome 🙂
i see the .exe file but is the actual script still available on github?
Hello, the script is in my Github https://github.com/sandytsang/Hyper-V/tree/main/Remove%20Hyper-V%20VMs
unable to find the .ps1 file on the github link, only thing i see is the .exe file
Hello, it’s in my Github https://github.com/sandytsang/Hyper-V/tree/main/Remove%20Hyper-V%20VMs