Windows 8 and 8.1 Forums


Hyper-V Virtual Machine - Completely Delete in Windows 8

  1. #10


    Posts : 22,279
    64-bit Windows 10


    It sounds like there may have been a mistake made in the command if it deleted any other VM than the one specified in the command.

    Does the virtual hard drives still exist for the virtual machines?

    If so, then you could see if you may be able to import the VM using OPTION THREE below by selecting the virtual hard drive of the VM.

    Hyper-V Virtual Machine - Export and Import in Windows 8

      My System SpecsSystem Spec

  2. #11


    Posts : 4
    win


    It deleted all non running VM vhds, all symlinks and index file.... I was able to restore virtual machines, which were running during execution of a script.....All others were completely removed...
      My System SpecsSystem Spec

  3. #12


    Posts : 22,279
    64-bit Windows 10


    The command will only delete a specific VM, so the only thing I can think of is that you may have made a mistake made with the command for the VM name.
      My System SpecsSystem Spec

  4. #13


    Posts : 4
    win


    super important VM's were running, just some testing were off. So almost no damage, but when I ran command and all vm disappeared form manager I almost s**t myself.....
    Last edited by Brink; 17 May 2016 at 10:15.
      My System SpecsSystem Spec

  5. #14


    There's definitely something a little off with that script. On a 2012 R2 HV host I open PS as admin and tried to delete one VM named "OPMANAGER":

    Code:
    Windows PowerShell
    Copyright (C) 2014 Microsoft Corporation. All rights reserved.
    
    
    PS C:\Windows\system32> get-vm
    
    
    Name          State   CPUUsage(%) MemoryAssigned(M) Uptime     Status
    ----          -----   ----------- ----------------- ------     ------
    devsql2012-02 Running 2           9664              2.10:24:30 Operating normally
    IMSQLTEST01   Off     0           0                 00:00:00   Operating normally
    OPMANAGER     Off     0           0                 00:00:00   Operating normally
    SPICEWORKS    Off     0           0                 00:00:00   Operating normally
    
    
    
    
    PS C:\Windows\system32> Get-VM "OPMANAGER" | %{ Stop-VM -VM $_ -Force; Remove-VM -vm $_ -Force ; Remove-Item -Path $_.Pa
    th -Recurse -Force}
    WARNING: The virtual machine is already in the specified state.
    Remove-Item : Cannot remove item D:\HyperV\Virtual Machines\BB148AF1-1F74-4B74-B8A8-393AB97B6256.xml: The process
    cannot access the file 'BB148AF1-1F74-4B74-B8A8-393AB97B6256.xml' because it is being used by another process.
    At line:1 char:74
    + Get-VM "OPMANAGER" | %{ Stop-VM -VM $_ -Force; Remove-VM -vm $_ -Force ; Remove- ...
    +                                                                          ~~~~~~~
        + CategoryInfo          : WriteError: (BB148AF1-1F74-4B74-B8A8-393AB97B6256.xml:FileInfo) [Remove-Item], IOExcepti
       on
        + FullyQualifiedErrorId : RemoveFileSystemItemIOError,Microsoft.PowerShell.Commands.RemoveItemCommand
    Remove-Item : Cannot remove item D:\HyperV\Virtual Machines: The directory is not empty.
    At line:1 char:74
    + Get-VM "OPMANAGER" | %{ Stop-VM -VM $_ -Force; Remove-VM -vm $_ -Force ; Remove- ...
    +                                                                          ~~~~~~~
        + CategoryInfo          : WriteError: (Virtual Machines:DirectoryInfo) [Remove-Item], IOException
        + FullyQualifiedErrorId : RemoveFileSystemItemIOError,Microsoft.PowerShell.Commands.RemoveItemCommand
    Remove-Item : Cannot remove item D:\HyperV: The directory is not empty.
    At line:1 char:74
    + Get-VM "OPMANAGER" | %{ Stop-VM -VM $_ -Force; Remove-VM -vm $_ -Force ; Remove- ...
    +                                                                          ~~~~~~~
        + CategoryInfo          : WriteError: (D:\HyperV:DirectoryInfo) [Remove-Item], IOException
        + FullyQualifiedErrorId : RemoveFileSystemItemIOError,Microsoft.PowerShell.Commands.RemoveItemCommand
    It did delete the OPMANAGER VM and it didn't appear to delete any others, but it definitely seemed to be trying to delete stuff it shouldn't.

    Thanks,
    Chaz
      My System SpecsSystem Spec

Page 2 of 2 FirstFirst 12
Hyper-V Virtual Machine - Completely Delete in Windows 8
Related Threads
How to Create a Linux Hyper-V Virtual Machine in Windows 8 Although best when running Windows guests, Windows 8 built-in Microsoft Hyper-V can also be used to run Linux guests. Officially Hyper-V only supports SUSE and Red Hat enterprise server distributions but with a few simple tricks any...
I'm using an AlienWare M14 machine. I tried to create a virtual machine locally using Client Hyper-V on Windows 8 Pro, but it still doesn't work (took me a lot of time). I added the Hyper-V features in "Turn windows feature on or off", and all of the requirements to run Hyper-V are fulfilled (SLAT,...
How to Export and Import a Hyper-V Virtual Machine in Windows 8 and 8.1 The Hyper-V technology provides an environment that you can use to create and manage virtual machines and their resources. Each virtual machine is an isolated, virtualized computer system that is capable of running its own...
Installed windows 8.0 pro on oracle VM VirtualBox (running 8.1 pro on host machine) and it asks me to activate windows. Okay, but it doesn't accept the product key I purchased for the host machine. what to do?
OK, so I finally got my copy of Window 8 Pro from my school, and am wondering if I can try it out on a virtual machine? If so, which virtual software would you recommend? Thanks.
Hey all. I just recently purchased a laptop with Windows 8 and wanted to set up a VM of Windows 7 on it. I have never worked with VM's before and I'm ready to get it going. Could anyone provide any help as to how to do it. Thanks!!!
Solved Windows 8 Virtual Machine in Virtualization
I had installed windows 8 in VBOX. I could not get the sound to work. It stated no Audio detected. I uninstalled it, and reinstalled it in VMWARE. It is working fine. I tried to run it again in VBOX but the same thing, no audio drivers detected. I am running it in VMWARE and it is working great,...
Eight Forums Android App Eight Forums IOS App Follow us on Facebook