You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

Macrium多光盘自动恢复VBS脚本故障排查求助

Fixing VBS Script Issue for Split-Disc Macrium Image Restores

Hey there, I see the problem you're facing—your original VBS script works great for single-disc Macrium images, but now that your backup is split across two discs (with 00-00.mrimg and 00-01.mrimg), Macrium throws that "Backup set is not complete" error because the script only loads the first disc's file without ensuring the second is available.

Below is the modified script that addresses this by:

  • First locating the disc with 00-00.mrimg
  • Prompting you to insert the second disc containing 00-01.mrimg
  • Verifying the second disc is present before launching the restore
'AutoRestore.vbs
Dim fso, d, dc, Root, u, racine, folder, folderName, restoreStringFirst, restoreStringSecond
Dim foundFirstFile, foundSecondFile, cdDrive, objShell

Set objShell = WScript.CreateObject("WScript.shell")
Set fso = CreateObject("Scripting.FileSystemObject")
Set dc = fso.Drives

foundFirstFile = false
foundSecondFile = false
restoreStringFirst = "00-00.mrimg"
restoreStringSecond = "00-01.mrimg"

' Step 1: Locate the first disc with 00-00.mrimg
For Each d in dc
    Root = d.Driveletter & ":"
    racine = d.Driveletter & ":\"
    u = Detect(Root)
    
    If u = "CD-ROM" Then
        cdDrive = cdDrive & racine & " "
        If d.isReady Then
            folderName = racine & "IAS\"
            If fso.FolderExists(folderName) Then
                Set folder = fso.GetFolder(folderName)
                For Each file in folder.Files
                    If Instr(1, file.Name, restoreStringFirst, vbTextCompare) > 0 Then
                        foundFirstFile = true
                        Exit For
                    End If
                Next
                If foundFirstFile Then Exit For
            End If
        End If
    End If
Next

If Not foundFirstFile Then
    MsgBox "Could not locate IAS folder containing " & restoreStringFirst & "." & vbCrLf & _
           "Searched drives: " & cdDrive & vbCrLf & "Verify media or use manual restore.", 48, "First Image Not Found"
    WScript.Quit
End If

' Prompt user to insert the second disc
MsgBox "Please insert the second CD with " & restoreStringSecond & " into your optical drive, then click OK.", 64, "Insert Second CD"

' Loop until the second disc is detected
Do While Not foundSecondFile
    foundSecondFile = false
    For Each d in dc
        u = Detect(d.Driveletter & ":")
        If u = "CD-ROM" And d.isReady Then
            folderName = d.Driveletter & ":\IAS\"
            If fso.FolderExists(folderName) Then
                Set folder = fso.GetFolder(folderName)
                For Each file in folder.Files
                    If Instr(1, file.Name, restoreStringSecond, vbTextCompare) > 0 Then
                        foundSecondFile = true
                        Exit For
                    End If
                Next
                If foundSecondFile Then Exit For
            End If
        End If
    Next
    If Not foundSecondFile Then
        MsgBox "Could not find " & restoreStringSecond & " in any CD-ROM drive. Insert the correct disc and click OK.", 48, "Second Image Not Found"
    End If
Loop

' Launch Macrium restore—diskrestore.exe will auto-detect the split backup set
Dim return
return = objShell.Run("""%ProgramFiles%\macrium\diskrestore.exe""" & folderName & restoreStringFirst & " -r -g -u --targetnum 0 --reboot --eject", 1, false)

Function Detect(DrivePath)
    Dim fsoDetect, dDetect, t
    Set fsoDetect = CreateObject("Scripting.FileSystemObject")
    Set dDetect = fsoDetect.GetDrive(fsoDetect.GetDriveName(fsoDetect.GetAbsolutePathName(DrivePath)))
    Select Case dDetect.DriveType
        Case 0: t = "Unknown"
        Case 1: t = "Removable"
        Case 2: t = "Fixed"
        Case 3: t = "Network"
        Case 4: t = "CD-ROM"
        Case 5: t = "RAM Disk"
    End Select
    Detect = t
End Function

Key Changes Explained:

  • Dual-File Detection: The script now checks for both 00-00.mrimg and 00-01.mrimg instead of just the first one.
  • User Prompt for Second Disc: After finding the first disc, it explicitly tells you to insert the second disc, ensuring you have time to swap media.
  • Loop Until Second Disc is Found: It will keep checking drives until it finds the second image file, so you don't have to worry about timing the disc swap perfectly.
  • Robust Folder Checks: Added fso.FolderExists() to avoid errors if the IAS folder isn't present on a disc.

Once both discs are detected, Macrium's diskrestore.exe will automatically recognize the split backup set, so you won't get the "incomplete backup" error anymore.

内容的提问来源于stack exchange,提问作者DRuppe

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.05.14 08:31:29