powershellsnapshot

vssadmin don't want reconize shadowID (Invalid option value)


I'm wondering why my Shadown ID of a snaphot is not reconize when i want to select or delete it...

Context

I have created my snapshot with this:

$snapshot = Invoke-CimMethod -ClassName Win32_ShadowCopy -MethodName Create -Arguments @{Volume='D:\' }

And that the output:

$snapshot

ReturnValue ShadowID                               PSComputerName
----------- --------                               --------------
          0 {5905C83A-58ED-408F-816B-AF61881199FB}

But when i want to select it or delete it, vssadmin tell me there is an error...

vssadmin list shadows /shadow={5905C83A-58ED-408F-816B-AF61881199FB}

Output :

vssadmin 1.1 - Volume Shadow Copy Service administrative command-line tool
(C) Copyright 2001-2013 Microsoft Corp.

Error: Invalid option value.

EDIT

I have try omitting the curly braces, pass the value by variable ($Snapshot.shadowID)... Nothing new


Solution

  • As mentioned in the comments, you need to pass the GUID without the {} curly braces. The default string representation will do:

    vssadmin list shadows /shadow="$($snapshot.ShadowId)"