none
Hyper-V ... encountered an error trying to access an object on computer ... object was not found. The object might have been deleted RRS feed

  • 問題

  • Hello - new to Hyper-V, been learning for a few weeks now...stuck on an issue.  I've found this error in several searches, but nothing is resolving the issue for me. 

    Error:  Hyper-V encountered an error trying to access an object on computer 'XXXXXXXXXXX' because the object was not found. The object might have been deleted, or you might not have permission to perform the task. Verify that the Virtual Machine Management service on the computer is running. If the service is running, try to perform the task again by using Run as Administrator.

    Environment: Windows 10 laptop, Virtualization (BIOS) Enabled...this is my host/lab env.  All Hyper-V Role options installed.  Creating Win2016 Server VMs Gen2, .VHDX.

    I can create a GEN1 VM via PS, DSC and manually just fine.  I can create a GEN2 VM manually, get error above when using PS or DSC.  Found the WindowsVirtualizationMOF fix and tried, it prevented me from creating GEN2 even manually, so uninstalled/reinstalled Hyper-V to fix.  Now can create GEN2 manually.

    Even if I use PS only and try the following, get same error for Gen2...(Gen 1 works fine):

    $VMName = "ZTST123"

    $VM = @{
       Name = $VMName
       MemoryStartupBytes = 2147483648
       Generation = 2
       NewVHDPath = "C:\Hyper-V\"+$VMName+"\Virtual Hard Disks\"+$VMName+".vhdx"
       NewVHDSizeBytes = 20687091200
       BootDevice = "VHD"
       Path = "C:\Hyper-V\"+$VMName+"\Virtual Machines"
       SwitchName = "Wireless_HyperV"
     }

    New-VM @VM

    I'm stuck, would appreciate direct answer to resolve this issue.  Thank you


    • 已編輯 My55Tec 2018年4月13日 下午 01:32 SPAM blocking ... not spam!
    2018年4月13日 下午 01:25

所有回覆

  • Found I can create new VM (Gen 2) without VHD, then copy/clone SYSPrep'd VHDx, add it to the VM and then start the VM.  This is exactly how I had to do it manually via Hyper-V Manager.

    This is not the solution though, should be able to copy/clone SYSPrep'd VHDx and then run New-VM cmdlets with -VHDPath ... when this is done, get error mentioned in subject.  Also, see no way to create VM without VHD via DSC, so this would not work for DSC (which is final goal).

    ## ----- Works, but have to create VM without VHD, copy/clone
    ## ----- VHDx and then add the VHDx to VM
    $vhdPath = 'C:\Hyper-V\TEST1\Virtual Hard Disks\TEST1.vhdx'
    New-VM -Name TEST1 -MemoryStartupBytes 2GB -NoVHD -SwitchName "Wireless_HyperV" -Path C:\Hyper-V -Generation 2
    New-Item -Path (Split-Path $vhdPath) -Type Directory
    Copy-Item -Path 'C:\Hyper-V\Clone_2016SrvGen2\Virtual Hard Disks\Clone_Win2016SrvGen2_vhdx.vhdx' -Destination $vhdPath -Force
    Add-VMHardDiskDrive -VMName TEST1 -ControllerType SCSI -ControllerNumber 0 -ControllerLocation 0 -Path $vhdPath

    ## ----- Throws error, but should work ... this is what I need
    ## ----- help with, getting this to work
    $vhdPath = 'C:\Hyper-V\TEST1\Virtual Hard Disks\TEST1.vhdx'
    New-Item -Path (Split-Path $vhdPath) -Type Directory
    Copy-Item -Path 'C:\Hyper-V\Clone_2016SrvGen2\Virtual Hard Disks\Clone_Win2016SrvGen2_vhdx.vhdx' -Destination $vhdPath -Force
    New-VM -Name TEST1 -MemoryStartupBytes 2GB -SwitchName "Wireless_HyperV" -Path C:\Hyper-V -Generation 2 -VHDPath $vhdPath

    # ----- This is the Error that's shown ----- ##
    #  New-VM : Hyper-V encountered an error trying to access an
    #  object on computer 'XXXXXXXXXXX' because the object was
    #  not found. The object might have been deleted, or you might
    #  not have permission to perform the task. Verify that the
    #  Virtual Machine Management service on the computer is running.
    #  If the service is running, try to perform the task again by
    #  using Run as Administrator.
    #  At line:1 char:1
    #  + New-VM -Name TEST1 -MemoryStartupBytes 2GB -SwitchName "Wireless_Hype ...
    #  + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    #      + CategoryInfo          : ObjectNotFound: (:) [New-VM], VirtualizationException
    #      + FullyQualifiedErrorId : ObjectNotFound,Microsoft.HyperV.PowerShell.Commands.NewVM




    • 已編輯 My55Tec 2018年4月14日 上午 09:40 minor add
    2018年4月14日 上午 08:58
  • Hi,

    Please run the following command to rebuild the WMI components for virtualization.

    MOFCOMP %SYSTEMROOT%\System32\WindowsVirtualization.V2.mof

    Note: This command is run on the Hyper-V host.


    Please remember to mark the replies as answers if they help.
    If you have feedback for TechNet Subscriber Support, contact tnmff@microsoft.com.

    2018年4月16日 上午 09:03
    版主
  • Hi - thanks for reply, but that did not help.  As mentioned in original post, I've already tried that and ran into other problems.  Also found other postings that specifically state "do not run MOFCOMP" and that the fix is to uninstall/reinstall Hyper-V.

    Reluctantly, I took your advice, ran MOFCOMP and rebooted ... still had the exact same error when running via PS cmdlets and DSC.

    Still looking for solution to this problem...

    2018年4月16日 上午 11:21
  • Hi,

    Before we move on, to avoid any misunderstanding, could you help to clarify if you would like to use PS or DSC to create Generation 2 virtual machine with vhd?

    If so, have you import module xHyper-V before creating virtual machines?

    Then, if you have import the module xHyper-V, please refer to the following article to create virtual machine by PowerShell or DSC:

    PowerShell reference:

    Create a virtual machine in Hyper-V

    https://docs.microsoft.com/en-us/windows-server/virtualization/hyper-v/get-started/create-a-virtual-machine-in-hyper-v

    DSC reference:

    How To Use PowerShell DSC To Build A Hyper-V Virtual Machine

    http://www.tomsitpro.com/articles/hyper-v-desired-state-configuration,2-1001.html

    Note: this is a 3rd party link, we don't have any warranties on this website. It's just for your convenience.

    Thanks very much for your cooperation and understanding.


    Please remember to mark the replies as answers if they help.
    If you have feedback for TechNet Subscriber Support, contact tnmff@microsoft.com.

    2018年4月18日 上午 09:51
    版主
  • HI - PS or DSC ... either, both.  At this point, neither one works as described above.  Final goal is to have it all done via DSC, but if I could get answer to PS solution, could make that work in DSC.  Explained my work around above, but that's not the preferred method.

    Thanks.

    2018年4月20日 上午 10:35
  • Hi My55Tec,

    Thanks for your reply.

    Based on the confirmation, let’s focus on using PS to create Generation 2 virtual machine with vhd. Still, for further research, would you please tell us if  you have import module xHyper-V before creating virtual machines?

    Also, if you have import the module xHyper-V, have you refer to the following article to create virtual machine with powershell? If it fails, is there any error message screenshot?

    Create a virtual machine in Hyper-V

    https://docs.microsoft.com/en-us/windows-server/virtualization/hyper-v/get-started/create-a-virtual-machine-in-hyper-v

    Thanks again for your kind understanding.


    Please remember to mark the replies as answers if they help.
    If you have feedback for TechNet Subscriber Support, contact tnmff@microsoft.com.

    2018年4月24日 上午 09:45
    版主
  • Hi,

    Was your issue resolved?

    If yes, please mark the helpful reply as answer in order that other community members could find the helpful reply quickly.

    If no, please reply and tell us the current situation in order to provide further help.


    Please remember to mark the replies as answers if they help.
    If you have feedback for TechNet Subscriber Support, contact tnmff@microsoft.com.

    2018年4月27日 上午 08:53
    版主
  • My apologies ... never got around the issue on Win10, but I've moved on.  Win10 was my test lab environment until I had 2016 server build.  Just got this recently and found no issue whatsoever creating Gen2 VMs there using the exact same process (PS and DSC).  There were actually DSC cmdlets that worked on 2016 that did not work on Win10 for my lab.  So that was a relief.  I'm all set, thanks for your help.
    • 已編輯 My55Tec 2018年4月27日 下午 03:08 typo
    2018年4月27日 下午 03:07
  • Ok. Thanks for your updating.

    If so, I will close this thread.


    Please remember to mark the replies as answers if they help.
    If you have feedback for TechNet Subscriber Support, contact tnmff@microsoft.com.

    2018年5月1日 上午 07:29
    版主
  • I was having the same error message just trying to connect to the Hyper-V manager on the localhost and the following steps resolved my issue maybe it will help you:

    1. Open "Window Security"
    2. Open "App & Browser control"
    3. Click "Exploit protection settings" at the bottom
    4. Switch to "Program settings" tab
    5. Locate "C:\WINDOWS\System32\vmcompute.exe" in the list and expand it
    6. Click "Edit"
    7. Scroll down to "Code flow guard (CFG)" and uncheck "Override system settings"
    8. Start vmcompute from powershell "net start vmcompute"

    2019年2月14日 下午 05:51
  • Perfect ! this worked for me. 

    But why this is happening in windows server 2019...

    Regards,

    Abhilash. 

    2019年2月21日 下午 01:07
  • This solved it for me - Thanks Dan!!
    2019年4月4日 上午 06:00
  • Hats off for your solution. Thank you so much.

    But why it is happening even yesterday itself I reset my m/c. In some other m/c this problem is not there

    2019年5月16日 下午 02:58
  • Thank you . This solved it for me,
    2019年7月12日 上午 10:14
  • Thank you so much. This works me!!!!
    2019年9月19日 下午 01:31
  • thank you man I works like a magic

    2019年10月9日 上午 08:55