roger's picture

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

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.

Reply

The content of this field is kept private and will not be shown publicly.
  • Allowed HTML tags: <a> <b> <blockquote> <br> <code> <dd> <dl> <dt> <hr> <h1> <h2> <h3> <i> <img> <li> <ol> <p> <pre> <table> <td> <th> <tr> <tt> <u> <ul>
  • Images can be added to this post.

More information about formatting options