WinXp and not disposed snapshots

Dec 8, 2009 at 1:29 PM

Hey!

I have a console app which uses AlphaVSS to create a Snapshot. So far so good.

Now when I run on WinXp and someone kills me either by pressing Ctrl+C or Kill in taskmanager,
and wants to run the app again, you will get the following Exception:

ERROR: The maximum number of volumes has already been added to the shadow copy set.

But wihen I call QuerySnapshots, there are no snapshots available (which could be deleted).
So any idea's what I could do?

Ciao Ephraim

May 6, 2010 at 11:02 AM

Hi,

did you try to restart the VSS Service?

 

bye

 

May 6, 2010 at 11:09 AM

Hey Jangoman,

yeah I tried it, but with no success. What I did is, I caught the Ctrl+C in the app and disposed the vss snapshot correctly.

So, the problem is gone for Ctrl+C so far, for being killed not. But no one will blame me, when he kills the app and needs to wait some time or reboot before it works again.

Ciao Ephraim

May 6, 2010 at 12:00 PM

Hi Ephraim,

 

you are right, I just came across the same thing. My App crashed due to a bug after making a snapshot, so it did not release it.

And with XP you only have one shadowcopy.

Now I think I have to reboot in order to play again. :-(

 

bye,

Jangoman

 

May 6, 2010 at 12:06 PM

Hey Jangoman,

no, you haven't to reboot. I'm not sure how long it takes, but it "heals" itself after a while. ... I think 15 mins should be enough.

Ciao Ephraim

Aug 15, 2011 at 4:33 PM
Edited Aug 15, 2011 at 5:14 PM

.....I guess it would help to close down the snapshot by code. You could implement it in your code.
I use something like this:

    Sub DeleteAllSnapShots()
        Dim SnapShotsProp As Vss.VssSnapshotProperties
        Dim VSSImpl As Vss.IVssImplementation
        Dim oVSS As Vss.IVssBackupComponents
        VSSImpl = Vss.VssUtils.LoadImplementation
        oVSS = VSSImpl.CreateVssBackupComponents
        oVSS.InitializeForBackup(Nothing)

        For Each SnapShotsProp In oVSS.QuerySnapshots
            Debug.Print("Following SnapShotSet will be deleted:" & SnapShotsProp.SnapshotSetId.ToString)
            oVSS.DeleteSnapshotSet(SnapShotsProp.SnapshotSetId, True)
            'Debug.Print("SnapshotSetId:" & SnapShotsProp.SnapshotSetId.ToString)
            'Debug.Print("SnapshotId:" & SnapShotsProp.SnapshotId.ToString)
            'Debug.Print("Status:" & SnapShotsProp.Status.ToString)
            'Debug.Print("SnapshotDeviceObject:" & SnapShotsProp.SnapshotDeviceObject.ToString)
            'Debug.Print("OriginalVolumeName:" & SnapShotsProp.OriginalVolumeName)
        Next
        oVSS.AbortBackup()
        oVSS.Dispose()
        Debug.Print("Done!")
    End Sub