1

Gives me a headache.

I have a ton of differential discs. In order to move the machiens around - and because (Thank heaven) vm move does NOT copy the sources of differential discs (sadly export does), my idea is to have a central copy of all the Masters on every Hyper-V computer.

Example: VM X has a vhdx named "System.vhdx" and that is differential from ...\masters\x64-2012std.vhdx"

To standardize the paths of the differential discs, I would like them to be in c:\Hyper-V\Masters....

Now, C does not always have enough space, so my idea was that \Masters\ in there is a junction to the real path.

Works, EXCEPT:

PowerShell set-vhd ......\system.vhdx -ParentPath c:\Hyper-V\Master.....goeson.vhdx

works, the VM starts, BUT...

get-vhd

leaves me do see that the vhdx is directly linked to the file - somehow Hyper-V found it nice to RESOLVE the junction and replace it with the "real" path of the file.

Which totally breaks when I move the VM to another host that has a diffrent disc layout (and we have currently planned 3 ones).

Now, is there any way to work around that? I would like the ParentPath to be the ParentPath AS I HAVE SET IT, not something changed, or to get an error.

TomTom
  • 51,649
  • 7
  • 54
  • 136

1 Answers1

1

PowerShell runs in an entirely different user context, and sometimes on an entirely different machine from Hyper-V itself. So any file path used within it must be fully expanded to be meaningful. For relative paths, there's simply no good answer to the question "relative to what" because file path expansions can be user-context specific.

I do understand, however, that your strategy has an answer to that question, but most of them don't. And the path expansion code is just using the underlying .net path expansion, which apparently expands reparse points.

You might try talking directly to the WMI layer, rather than using the PowerShell cmdlets. You can find a bunch of examples on Ben Armstrong's "Virtual PC Guy" blog.

Jake Oshins
  • 5,146
  • 18
  • 15
  • Not sure whether this is an answer, but yeah - that could work. Funny is that if you mount a partition for example on C:\Masters then it turns into a \\blabla\volume\\guid\ path - basically needs the same partition. That stops being helpfull at all. Those reparse points should stay. I will check WMI. – TomTom Jan 09 '13 at 09:35