Here is my code to create a Full Shadow copy. How do I implement backupschema to create incrementals?

Apr 14, 2011 at 9:24 PM

OK.   I'll post my sub routine below to show how I am originally creating the shadow copy.  Here is the goal.  I have written a program that takes the snapshot and ports it into a zipped image file. 

I need now to write a NEW routine that will snapshot an incremental copy of the previous snapshot.  From what I can tell I have to implement the

VssBackupSchema.Incremental but I can find absolutely no help on the matter.  Can someone offer some assistance?  Thanks....

 

 

    Public Sub Snapshot(ByRef VSSGUID As System.Guid, ByRef DeviceObject As String)
        Dim oVSSImpl As IVssImplementation = VssUtils.LoadImplementation()
        Using oVSS As IVssBackupComponents = oVSSImpl.CreateVssBackupComponents()
            oVSS.InitializeForBackup(Nothing)
            oVSS.SetContext(VssVolumeSnapshotAttributes.Persistent Or VssVolumeSnapshotAttributes.NoAutoRelease)
            oVSS.SetBackupState(False, True, VssBackupType.Differential, False)

            Using async As IVssAsync = oVSS.GatherWriterMetadata()
                async.Wait()
            End Using

            Dim gSet As Guid = oVSS.StartSnapshotSet()

            Dim gSnapshot As Guid = oVSS.AddToSnapshotSet("C:\", Guid.Empty)

            Using async As IVssAsync = oVSS.PrepareForBackup()
                async.Wait()
            End Using

            Using async As IVssAsync = oVSS.DoSnapshotSet()
                async.Wait()
            End Using
            VSSGUID = oVSS.GetSnapshotProperties(gSnapshot).SnapshotId
            DeviceObject = oVSS.GetSnapshotProperties(gSnapshot).SnapshotDeviceObject
        End Using
    End Sub