For some reasons I won't debate here, I would like to be able to export VMs (on a Win 2019 hyper-v host) to "hidden" volumes (with no drive letter attached). While this works from the hyper-v GUI, I can't manage to make it work from PowerShell. Eg:
export-vm -name VMxxxxx -path "\\?\Volume{8a2e6c68-1d8a-4510-86e6-171344608919}\Test"
export-vm : Failed to create export directory.
Failed to create export directory with error 'The filename, directory name, or volume label syntax is
incorrect.'(0x8007007B): VMxxxxx(AAAAAAAA-EA6D-4F2B-9582-A52A044C2B65).
I also tried "\\?\Volume{8a2e6c68-1d8a-4510-86e6-171344608919}\\"
, but same result.
Using the GUI, I just enter \\?\Volume{8a2e6c68-1d8a-4510-86e6-171344608919}\Test
, in the Location field of "Export Virtual Machine" pop-up window, and the Export works!
Microsoft doc doesn't mention Export-VM path accepts Volume ID, but as it works from the GUI, I am assuming there should be a mean to do it in PS... Maybe I am wrong. Any idea? Thank you