Search code examples
c#powershellwmivolume-shadow-service

Using wmi to get the VSS shadow copy's dos path


vssadmin list shadows show the dos path of every volume copy, in the following form:

\\?\GLOBALROOT\Device\HarddiskVolumeShadowCopy4 

Is there a way to do this using wmi?

I'ved looked through Win32_ShadowCopy and experimented with it a bit, but couldn't find anything that gives the dos path. The other classes on msdn don't seem to have it either, I must be missing something.


Solution

  • The DeviceObject field provides this path in the Win32_ShadowCopy class.

    The latter can be obtained as usual, e.g. using the query SELECT * FROM Win32_ShadowCopy.

    Sidenote: I was searching for dos in the page which didn't exist, found it after re-reading the (rather long) doc page a couple more times.