Unable to Clear VSS Shadow Copies

Thomas Grassi
Thomas Grassi used Ask the Experts™
on
Windows 2012 R2

I use the Veeam Agent to backup this physical server

The Veeam Agent requires the Shadow copies to be cleared in order to get a successful backup.

I wrote a small PowerShell script to accomplish this

$LogFolder = "c:\util\logs"
$LogFile = "vss.txt"

remove-item -path $LogFolder\$LogFile -Force 

vssadmin list shadows >>$LogFolder\$LogFile
vssadmin delete shadows /all /quiet >>$LogFolder\$LogFile
vssadmin list shadows >>$LogFolder\$LogFile

Open in new window


 
The results below.

For some reason it does not delete all the shadow copies.

This has been working for a long time and this started about a week ago.

When I run the commands manually I get the same results

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

Contents of shadow copy set ID: {9a7fb7de-a033-498c-aa71-b1cc83f242b8}
   Contained 1 shadow copies at creation time: 11/1/2019 00:00:10
      Shadow Copy ID: {9e7a830a-ce1f-41fc-a201-28d01533feba}
         Original Volume: (C:)\\?\Volume{49475b43-1610-11e5-80b5-806e6f6e6963}\
         Shadow Copy Volume: \\?\GLOBALROOT\Device\HarddiskVolumeShadowCopy1
         Originating Machine: TGCS011.our.network.tgcsnet.com
         Service Machine: TGCS011.our.network.tgcsnet.com
         Provider: 'Microsoft Software Shadow Copy provider 1.0'
         Type: ApplicationRollback
         Attributes: Persistent, No auto release, Differential, Auto recovered

Contents of shadow copy set ID: {3e7ad88c-8891-4262-8cae-c8e3188a71b9}
   Contained 1 shadow copies at creation time: 12/1/2019 01:00:09
      Shadow Copy ID: {acad4a90-eff3-4c7d-80da-8609bf7c1347}
         Original Volume: (C:)\\?\Volume{49475b43-1610-11e5-80b5-806e6f6e6963}\
         Shadow Copy Volume: \\?\GLOBALROOT\Device\HarddiskVolumeShadowCopy35
         Originating Machine: TGCS011.our.network.tgcsnet.com
         Service Machine: TGCS011.our.network.tgcsnet.com
         Provider: 'Microsoft Software Shadow Copy provider 1.0'
         Type: ApplicationRollback
         Attributes: Persistent, No auto release, Differential, Auto recovered

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

Error: Snapshots were found, but they were outside of your allowed context.  Try removing them with the
backup application which created them.

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

Contents of shadow copy set ID: {9a7fb7de-a033-498c-aa71-b1cc83f242b8}
   Contained 1 shadow copies at creation time: 11/1/2019 00:00:10
      Shadow Copy ID: {9e7a830a-ce1f-41fc-a201-28d01533feba}
         Original Volume: (C:)\\?\Volume{49475b43-1610-11e5-80b5-806e6f6e6963}\
         Shadow Copy Volume: \\?\GLOBALROOT\Device\HarddiskVolumeShadowCopy1
         Originating Machine: TGCS011.our.network.tgcsnet.com
         Service Machine: TGCS011.our.network.tgcsnet.com
         Provider: 'Microsoft Software Shadow Copy provider 1.0'
         Type: ApplicationRollback
         Attributes: Persistent, No auto release, Differential, Auto recovered

Contents of shadow copy set ID: {3e7ad88c-8891-4262-8cae-c8e3188a71b9}
   Contained 1 shadow copies at creation time: 12/1/2019 01:00:09
      Shadow Copy ID: {acad4a90-eff3-4c7d-80da-8609bf7c1347}
         Original Volume: (C:)\\?\Volume{49475b43-1610-11e5-80b5-806e6f6e6963}\
         Shadow Copy Volume: \\?\GLOBALROOT\Device\HarddiskVolumeShadowCopy35
         Originating Machine: TGCS011.our.network.tgcsnet.com
         Service Machine: TGCS011.our.network.tgcsnet.com
         Provider: 'Microsoft Software Shadow Copy provider 1.0'
         Type: ApplicationRollback
         Attributes: Persistent, No auto release, Differential, Auto recovered
Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
Commented:
Have a look using diskshadow command.  Start cmd prompt as admin (or powershell) and start it like this.... I use that for keeping an eye on some on one remote server.

diskshadow
list shadows all

While in the diskshadow interface you can type in

delete

and it will show you the various options there, e.g.:

delete shadows oldest
delete shadows all
delete shadows c:

etc.

Should do the same as vssadmin but worth a try.

Steve
Thomas GrassiSystems Administrator

Author

Commented:
Steve,

Thank you for the help.

That cleared all the shadow copies

Now off to script this so I can run this prior to my backup each night.

Thanks again

Tom

Commented:
Good to know, no idea why that works differently to VSSADMIN but clearly does.  I normally make a scipt file on the fly something like:

@echo off
(echo LIST SHADOWS ALL) > "%temp%\ds.txt"
diskshadow /s "%temp%\ds.txt" /l "%temp%\ds-log.txt"
Thomas GrassiSystems Administrator

Author

Commented:
I created a file
diskshadow.txt

list shadows all
delete shadows all
list shadows all

Open in new window


My powershell script

$LogFolder = "c:\util\logs"
$LogFile = "vss.txt"

remove-item -path $LogFolder\$LogFile -Force 

diskshadow -s diskshadow.txt >>$LogFolder\$LogFile
#vssadmin list shadows >>$LogFolder\$LogFile
#vssadmin delete shadows /all /quiet >>$LogFolder\$LogFile
#vssadmin list shadows >>$LogFolder\$LogFile

$bigbody = get-content("$LogFolder\$LogFile") | out-string
$Server = hostname 

$Params = @{
   Subject = "$Server Delete VSS Report"
   Body = "$bigbody"
   From = "no-reply@mydom.com"
   To = "systems-alert@mydom.com"
   smtpserver = "InternalRelay.mydom.COM"
}

Send-MailMessage @Params

Open in new window

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial