VB code for disk imaging

Asked By 10 points N/A Posted on -
qa-featured

Hello techyv experts!!!!

I am looking for Visual Basic (vb) code for disk imaging. Can I copy the hard drive image similar to Norton Ghost or Disk in VB6 or VBScript? Can anybody help?

SHARE
Answered By 0 points N/A #132521

VB code for disk imaging

qa-featured

Hi,

I am writing a best and optimized code of VB for the disk image.

Function CreateBackup(DriveLetter As String, ImageFilePath As String)
    Set My.DriveSnapshot = New cApp_DriveSnapshot 'Class that 'remote' controls snapshot.exe tool   
    Dim SnapshotData As cApp_Snapshot 'Class that contains all necessary Data for a Backup   
    Set SnapshotData = New cApp_Snapshot   
    With SnapshotData
        .DriveLetter = Left(DriveLetter, 1)
        .FilePath = ImageFilePath
        .VolumeShadowService = "default"
        .DebugMode = True 'show engine tool window

    End With   
    My.DriveSnapshot.Init
    My.DriveSnapshot.CreateSnapshot2 SnapshotData
    'Set My.DriveSnapshot = New cApp_DriveSnapshot 'Class that 'remote' controls snapshot.exe tool
    'My.DriveSnapshot.Restore  "D:Backup1.sna", "C:", "D:Backup1.sna"   
End Function

Call it as:

My.CreateBackup "C:", "D:Backup1.sna"

Incase if you don’t want the main window to be shown, then comment out "Me.Gui.Init" in cApp.Run.

Best Regards

Taylor Joseph

Related Questions