Hyper-V: creating a new Virtual Hard Disk fails with "Cannot create a file when that file already exists"

roger's picture

My desktop PC is Windows 2008, with Hyper-V disabled. I've got a Windows 2008 R2 box to act as a Hyper-V server. I created an administrator user account with my name on the R2 box, and used HVRemote to allow remote access.

All good until I attempted to create a VHD file. Then I got "cannot create a file when that file already exists". Huh? The file definitely doesn't exist. What's going on?

UAC is what's going on.

Disable UAC (well, turn it all the way down, given that this is R2) and reboot the box.

But why the odd error message? Time for Process Monitor, but in short: the Hyper-V service attempts to open the C:\Users\Public\Documents\Hyper-V\Virtual hard disks directory and gets an Access Denied error (because of UAC). It misinterprets this, and attempts to create the directory. This gives the "file already exists" error, which is the one that's reported.

Comments

UAC problem

The reg entry of HKLM\Software\Windows\CurrentVersion\Policies\System\EnableLUA is alreday 0 on my Hyper-V R2 box. Why I still get that 'file already exits' error? That is how you disable UAC in R2, right? Reggie

Re: UAC problem

Dunno. I used the slider.

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.