1

I have an extremely obscure error: if I try to create a gen 2 (gen 1 works fine) VM with powershell, it errors out. Creating it with the Hyper-V manager remotely works fine.

Environment details: Windows Server 2016 Core Datacenter

Script causing the problem:

# New-LabVM

param(
    [Parameter(Mandatory=$true)]
    [string]$Name,
    [long]$MemoryBytes = 1536MB,
    [long]$VHDSize = 20GB,
    [int]$VlanID = 100,
    [int]$Cores = 4
)

$vhdbasepath = 'V:\VHDs'

$vm = New-VM -Name $Name -MemoryStartupBytes $MemoryBytes -BootDevice NetworkAdapter -SwitchName Main -Generation 2 -NewVHDPath (Join-Path $vhdbasepath "${Name}.vhdx") -NewVHDSizeBytes $VHDSize

Error message:

New-VM : Hyper-V encountered an error trying to access an object on computer 'LF-HV02' 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.

I am signed in as builtin administrator, so that takes that possibility out of the equation.

2
  • Do you have access to that network drive? Have you checked Event Viewer? Jan 9 '17 at 5:54
  • @MichaelHampton it's an iSCSI target. Event Viewer is half useless because it seems that half the event IDs don't actually have messages. There are also some WMI errors but they were all a few hours old when I was testing this. Maybe I'll just reinstall Windows on this thing. Jan 10 '17 at 18:54
0

I got this error when the OS was stuck in "Shutdown state" after I restarted the machine. I restarted it again, then it started working.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.