I am trying to use vssadmin.exe within a Windows 2012 R2 server Powershell script, but I cannot workout how to get the Shadow ID & Volume Name as variables?
vssadmin create shadow /for=C:
vssadmin 1.1 - Volume Shadow Copy Service administrative command-line tool
(C) Copyright 2001-2013 Microsoft Corp.
Successfully created shadow copy for 'C:'
Shadow Copy ID: {b01a4dab-61b0-4cfb-908c-94278500b10d}
Shadow Copy Volume Name: \?\GLOBALROOT\Device\HarddiskVolumeShadowCopy853
As it’s a script, I guess it doesn’t matter if you don’t see output for vssadmin?
Select the two strings from the command’s output and assign them to a variable.
Split the strings and select the second element, trim to remove white space.