Unable to fetch information of Hyper-V shared disk(.vhds) when VM is running

Chidanand H S 6 Reputation points
2022-09-20T05:15:39.833+00:00

I am using two node Hyper-V csv cluster(windows2016).
I have created a shared disk(.vhds) and attached that shared disk to two VMs(both windows 2016)
I have followed all requirements required to use and take backup of Hyper-V VMs with shared disk:
Like guest failover cluster should be enabled in guest VMs, and nodes should be online, permission on folders etc etc.

When I try to fetch information of shared disk either by powershell commands or by methods, it gives proper information when VM IS TURNED OFF:
PS C:\Users\Administrator> Get-VHDSet -path "C:\ClusterStorage\Volume2\VMs\chidanand\2016-vhds1\Virtual Hard Disks\vhds1.vhds" -GetAllPaths

ComputerName Path SnapshotIdList AllPaths



H2K16-3DFS2 c:\clusterstorage\volume2\vms\chidanand\2016-vhds1\virtual hard disks\vhds1.vhds {4ECCDCBA-D8FA-40F0-996F-79A04019EC1A} {VHDS1_2ece7366-f62a-4b03-945d-c6...

But if I power ON VM and try to fetch information related to shared disk, it FAILS.
For example:
PS C:\Users\Administrator> Get-VHDSet -path "C:\ClusterStorage\Volume2\VMs\chidanand\sharedDisk1\sd2.vhds" -GetAllPaths
Get-VHDSet : Failed to get the disk information.
At line:1 char:1

  • Get-VHDSet -path "C:\ClusterStorage\Volume2\VMs\chidanand\sharedDisk ...
  • ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  • CategoryInfo : InvalidArgument: (:) [Get-VHDSet], VirtualizationException
  • FullyQualifiedErrorId : InvalidParameter,Microsoft.Vhd.PowerShell.Cmdlets.GetVHDSet

WITHOUT adding "-GetAllPaths", it will succeed(actual disk path won't be there). But I need to fetch information related to actual disk(disk name) associated with ".vhds". Hence I need it to work with GetAllPaths.

Same result with Get-VHDSnapshot also- fails when VM is RUNNING
PS C:\Users\Administrator> get-vhdsnapshot -Path "C:\ClusterStorage\Volume2\VMs\chidanand\2016-vhds1\Virtual Hard Disks\vhds1.vhds" -SnapshotId 4eccdcba-d8fa-40f0-996f-79a04019ec1a -GetParentPaths
get-vhdsnapshot : Failed to get the disk information.
At line:1 char:1

  • get-vhdsnapshot -Path "C:\ClusterStorage\Volume2\VMs\chidanand\2016-v ...
  • ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  • CategoryInfo : InvalidArgument: (:) [Get-VHDSnapshot], VirtualizationException
  • FullyQualifiedErrorId : InvalidParameter,Microsoft.Vhd.PowerShell.Cmdlets.GetVHDSnapshot

WITHOUT adding "-GetParentPaths", it will succeed. But I need to fetch information related to actual disk(disk name) associated with ".vhds".

I tried corresponding methods(when VM is ON)- GetVHDSetInformation and GetVHDSnapshotInformation. Behavior is same as above.

How to get information of actual disk associated with .vhds even when VM is running ?

Windows for business Windows Client for IT Pros Storage high availability Virtualization and Hyper-V
Windows for business Windows Server User experience Other
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. Limitless Technology 44,751 Reputation points
    2022-09-21T15:19:44.397+00:00

    Hello there,

    Are you running this script on the host that is using that shared storage?

    When the VHD is in use (for example by a VM or mounted in the OS) and it is on shared storage, the Get-VHD cmdlet can only access it from the host that is using it. Any other server trying to run the Get-VHD cmdlet will get an error that it is in use.

    -----------------------------------------------------------------------------------------------------------------

    --If the reply is helpful, please Upvote and Accept it as an answer–


Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.