A few pointers

Jan 26, 2009 at 1:20 AM
Hi there all...

I am using the following code on Vista x64 

 

        Dim oVSS As Vss.IVssBackupComponents
        Dim gSet As Guid
        Dim lCountOfDeletedSnapshots As Long = 0
        Dim oNonDeletedSnapshotID As New Guid
        Dim oVSSImpl As Vss.IVssImplementation

        Try
            oVSSImpl = Vss.VssUtils.LoadImplementation
            oVSS = oVSSImpl.CreateVssBackupComponents
            oVSS.InitializeForBackup(Nothing)
            oVSS.SetBackupState(False, True, Vss.VssBackupType.Full, False)
            Using async As Vss.IVssAsync = oVSS.GatherWriterMetadata()
                async.Wait()
            End Using
            gSet = oVSS.StartSnapshotSet()
            oVSS.AddToSnapshotSet("C:\", Guid.Empty)

            Using async As Vss.IVssAsync = oVSS.DoSnapshotSet()
                async.Wait()
            End Using

        Finally
            If Not IsNothing(oVSS) Then oVSS.Dispose()
        End Try

The line 'Using async As Vss.IVssAsync = oVSS.DoSnapshotSet()' throws a VSSBADSTATEEXCEPTION , so I must have missed out on something. Is there anything I could try to sort this out ?



Cheers

 

 

Jan 26, 2009 at 2:20 AM

Hi

Insert

  Using async As Alphaleonis.Win32.Vss.IVssAsync = vss.PrepareForBackup()
async.Wait()
End Using

before DoSnapshotSet

Jan 26, 2009 at 7:49 AM
Thanks champ.... worked a treat !