delete old VMs script

Based on #893
- renamed/reworked script
- deduplicated functions