Overblog
Editer l'article Suivre ce blog Administration + Créer mon blog

Check windows-bcedit partition

Publié le par damcuvelier

 

'Check_windows_partition with bcdedit
'On error Resume Next
Dim BOOTTABLE, oShell, sCmd, iRetVal
Dim gethomepath, oOsdV4, ProgressUI, Line
Dim objFSO, oCheck, Blocks, GoodBlock, demiblock, OSDRIVE
Const ForReading = 1, ForWriting = 2, ForAppending = 8

Set oShell = CreateObject("WScript.Shell")
Set oOsdV4 = CreateObject("Microsoft.SMS.TSEnvironment")

gethomepath=left(WScript.ScriptFullName,len(WScript.ScriptFullName)-len(WScript.ScriptName)-1)

sCmd = "%comspec% /c bcdedit /v /enum all"
set iRetVal = oShell.Exec(sCmd)
oCheck = iRetVal.StdOut.ReadAll

Set ProgressUI = CreateObject("Microsoft.SMS.TsProgressUI")
ProgressUI.CloseProgressDialog

Set objFSO = CreateObject("Scripting.FileSystemObject")
For Each Line In Split(oCheck,vbCrLf)
if trim(Line)="" _
or ubound(split(Line,"-------------------")) < 1 then
else
    For Each Blocks In Split(oCheck,"-------------------")
        If instr(Blocks,"Windows 7")>0 then
            If instr(Blocks,"Winre.wim")>0 then
            else
            demiblock = Split(Blocks,"partition=")(1)
            OSDRIVE = left(demiblock,2)
            oOsdV4("OSDRIVE") = OSDRIVE
            end if
        end if
    Next
end if
Next

Commenter cet article