Our team has kept scripts to automate our creation of VM machines. Since our VM environment is clustered, we have always used Volume GUID paths to point to the paths of the VHD and/or VHDX files for each of the VMs.
Since the GUID volume name contains a question mark, we've always gotten around this by doing a substitution of the question mark with a period.
For example, to create a VHD file, we have always done this.... The $vhdPath variable is the GUID volume path, which is identified earlier in the script.
New-VHD -Path $vhdPath.Replace("?",".") -Fixed -SizeBytes 70GB
After this is created, the script goes ahead and creates the VM
New-VM -MemoryStartupBytes 4GB -Name $VMName -SwitchName $SwitchName -Path $deviceid -VHDPath $vhdPath.Replace("?",".")
The $deviceid is the full GUID volume path, and the $vhdPath variable is the full GUID volume path, along with the VHD file name.
However, as we're trying to build VMs using Hyper-V 2012 R2, it appears that 2nd command, the creation of the VM itself, does not work anymore.
It complains that 'The network path was not found'. It seems to think, now that I changed the ? to a ., it thinks it's a UNC path of some sort.
However, the 1st command, the creation of the VHD file, still works correctly; no complaints there.
I find this really strange as the New-VHD command is successful; as I've verified that the VHD file gets created.
It's only the 2nd part, when trying to create the VM and pointing to the VHD file on the same guid volume path, with the exact same substitution, is when it fails.
This part has always worked when we are using Win 2008R2 Hyper-V and Win 2012 Hyper-V...
Any ideas?