Jump to content
Sign in to follow this  
lyledg

WinPE 2.0 Customisation manager

Recommended Posts

lyledg

I wrote this to to get around the constant command lines needed to mount, create and customise the WIM file for use with WinPE 2.0

Unzip, Run the EXE. Attached is a help file with screenshots.

Hopefully someone finds this useful..

Cheers

lyledg

Source Code:

#include <GUIConstants.au3>



Global $WAIKPETools, $OUTPUTFLDRrslt, $COMPONENT, $Yes = 6, $No = 7, $retry = 4, $Cancel = 2, $filename, $IMAGEXEXE
Dim $ARCH, $WAIKPATHCHECK, $RUNTASK, $COMMAND, $element, $i, $MOUNTRADcheck, $MOUNTRWRADcheck, $INFORADcheck, $MOUNTRAD, $MOUNTRWAD, $INFORAD, $WIMID

#Region ### START Koda GUI section ### Form=e:\_development work\_scripts\_wiim manager\wimm.kxf
$MAINFORM = GUICreate("WinPE 2.0 Customisation Manager", 664, 444, @DesktopWidth / 2 - 332, @DesktopHeight / 2 - 222)

GUISetIcon("D:05.ico")
$PageControl1 = GUICtrlCreateTab(8, 8, 650, 424)
$TabSheet2 = GUICtrlCreateTabItem("Customise Winpe 2.0")
$Group4 = GUICtrlCreateGroup("1) &Create WinPE Structure", 20, 40, 313, 225)
$Label3 = GUICtrlCreateLabel("WAIK folder path:", 35, 69, 88, 17)
$WAIKFLDR = GUICtrlCreateInput("", 32, 88, 281, 21)
$BRWSEBTN1 = GUICtrlCreateButton("&Browse", 253, 116, 49, 17, 0)
$Label4 = GUICtrlCreateLabel("Select Output folder:", 34, 132, 122, 17)
$OUTPUTFLDR = GUICtrlCreateInput("", 33, 160, 281, 21)
GUICtrlSetTip(-1, "Output folder path goes here")
$BRWSEBTN2 = GUICtrlCreateButton("&Browse", 252, 186, 49, 17, 0)
GUICtrlSetTip(-1, "Browse for output folder")
$Label5 = GUICtrlCreateLabel("Architecture Type:", 36, 219, 91, 17)
GUICtrlSetTip(-1, "Choose an Architecure type you are customising for")
$ARCHx64RAD = GUICtrlCreateRadio("x64", 187, 218, 41, 17)
$ARCHx86RAD = GUICtrlCreateRadio("x86", 134, 218, 41, 17)
$CREATEBTN = GUICtrlCreateButton("&Create", 252, 238, 65, 21, 0)
GUICtrlCreateGroup("", -99, -99, 1, 1)
$Group6 = GUICtrlCreateGroup("2) Mount WIM File", 20, 272, 313, 145)
$Label1 = GUICtrlCreateLabel("WIM Image ID: ", 34, 301, 79, 17)
$WINIDCMBO = GUICtrlCreateCombo("", 131, 299, 81, 25, $CBS_DROPDOWNLIST)
GUICtrlSetData(-1, "1|2|3|4|5|6|7|8", "1")
GUICtrlSetState($WINIDCMBO, $GUI_DISABLE)
$Group1 = GUICtrlCreateGroup("ImageX options", 32, 333, 281, 49)
;$INFORAD = GUICtrlCreateRadio(" /INFO", 208, 355, 57, 17)
;GUICtrlSetState(-1, $GUI_DISABLE)
$MOUNTRAD = GUICtrlCreateRadio(" /MOUNT", 40, 355, 65, 17)
GUICtrlSetState(-1, $GUI_DISABLE)
$MOUNTRWRAD = GUICtrlCreateRadio(" /MOUNTRW", 114, 355, 89, 17)
GUICtrlSetState(-1, $GUI_DISABLE)
GUICtrlCreateGroup("", -99, -99, 1, 1)
$MOUNTBTN = GUICtrlCreateButton("&Mount", 252, 391, 65, 21, 0)
GUICtrlSetState(-1, $GUI_DISABLE)
GUICtrlCreateGroup("", -99, -99, 1, 1)
$Group2 = GUICtrlCreateGroup("3) Peimg Options", 340, 42, 310, 100)
$FONTRAD = GUICtrlCreateRadio("WinPE-Font Support", 348, 80, 121, 17)
GUICtrlSetState(-1, $GUI_DISABLE)
$HTARAD = GUICtrlCreateRadio("WinPE-HTA-Package", 348, 100, 129, 17)
GUICtrlSetState(-1, $GUI_DISABLE)
$MDACRAD = GUICtrlCreateRadio("WinPE-MDAC-Package", 348, 120, 137, 17)
GUICtrlSetState(-1, $GUI_DISABLE)
$WMIRAD = GUICtrlCreateRadio("WinPE-WMI-Package", 495, 82, 129, 17)
GUICtrlSetState(-1, $GUI_DISABLE)
$SCRIPTINGRAD = GUICtrlCreateRadio("WinPE-Scripting-Package", 495, 121, 145, 17)
GUICtrlSetState(-1, $GUI_DISABLE)
$XMLRAD = GUICtrlCreateRadio("WinPE-XML-Package", 495, 102, 129, 17)
GUICtrlSetState(-1, $GUI_DISABLE)
$SELNONECHK = GUICtrlCreateCheckbox("Select None", 480, 55, 80, 17)
GUICtrlSetState(-1, $GUI_DISABLE)
$SELALLCHK = GUICtrlCreateCheckbox("Select All", 570, 55, 65, 17)
GUICtrlSetState(-1, $GUI_DISABLE)
GUICtrlCreateGroup("", -99, -99, 1, 1)
$Group4 = GUICtrlCreateGroup("4) Capture WIM", 340, 145, 310, 75)
$CAPTURELBL = GUICtrlCreateLabel("Once all customisations are complete, capture and create WIM file:", 352, 165, 250, 25)
$CAPTUREBTN = GUICtrlCreateButton("&Capture changes", 545, 193, 90, 21, 0)
GUICtrlSetState(-1, $GUI_DISABLE)
$Group7 = GUICtrlCreateGroup("5) ISO Image creation", 340, 225, 310, 160)
$Label2 = GUICtrlCreateLabel("Unmount WIM file for ISO Image creation:", 352, 248, 200, 17)
$UNMOUNTBTN = GUICtrlCreateButton("&Unmount WIM", 560, 245, 75, 21, 0)
GUICtrlSetState(-1, $GUI_DISABLE)
$Label6 = GUICtrlCreateLabel("Destination ISO folder", 356, 275, 107, 17)
$DSTFISOLDR = GUICtrlCreateInput("", 358, 300, 273, 21)
GUICtrlSetState(-1, $GUI_DISABLE)
$CREATEISOBTN = GUICtrlCreateButton("&Create ISO", 560, 340, 73, 21, 0)
GUICtrlSetState(-1, $GUI_DISABLE)
GUICtrlCreateGroup("", -99, -99, 1, 1)
GUICtrlCreateTabItem("")

$RESETBTN = GUICtrlCreateButton("Reset all", 480, 395, 73, 21, 0)
$CANCELBTN = GUICtrlCreateButton("Cancel", 570, 395, 73, 21, 0)
Global $check_array_WinPE_Comps[8]
Global $Reset_array_[7]


$check_array_WinPE_Comps[0] = $FONTRAD
$check_array_WinPE_Comps[1] = $HTARAD
$check_array_WinPE_Comps[2] = $MDACRAD
$check_array_WinPE_Comps[3] = $WMIRAD
$check_array_WinPE_Comps[4] = $SCRIPTINGRAD
$check_array_WinPE_Comps[5] = $XMLRAD
$check_array_WinPE_Comps[6] = $SELALLCHK
$check_array_WinPE_Comps[7] = $SELNONECHK



$Reset_array_[0] = $OUTPUTFLDR
$Reset_array_[1] = $BRWSEBTN2
$Reset_array_[2] = $ARCHx64RAD
$Reset_array_[3] = $ARCHx86RAD
$Reset_array_[4] = $CREATEBTN
$Reset_array_[5] = $DSTFISOLDR


GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###


MsgBox(64, "Info", "Please ensure the Microsoft WAIK is installed " & @CRLF & "to it's default path before running this tool.")


If FileExists("C:\Program Files\Windows AIK") Then
    $WAIKPETools = "C:\Program Files\Windows AIK\Tools\PETools\"
    GUICtrlSetData($WAIKFLDR, $WAIKPETools)
    GUICtrlSetState($WAIKFLDR, $GUI_DISABLE)
    GUICtrlSetState($BRWSEBTN1, $GUI_DISABLE)
    $WAIKTools = "C:\Program Files\Windows AIK\Tools\"
    
EndIf



While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE
            Exit
        Case $nMsg = $ARCHx64RAD
            If $ARCHx64RAD And BitAND(GUICtrlRead($ARCHx64RAD), $GUI_CHECKED) = $GUI_CHECKED Then
                $ARCH = "amd64"
                $IMAGEXEXE = '"C:\Program Files\Windows AIK\Tools\' & $ARCH & '\Imagex.exe"'
                
            EndIf
        Case $nMsg = $ARCHx86RAD
            If $ARCHx86RAD And BitAND(GUICtrlRead($ARCHx86RAD), $GUI_CHECKED) = $GUI_CHECKED Then
                $ARCH = "x86"
                $IMAGEXEXE = '"C:\Program Files\Windows AIK\Tools\' & $ARCH & '\Imagex.exe"'
                
            EndIf
        Case $nMsg = $MOUNTRAD
            If $MOUNTRAD And BitAND(GUICtrlRead($MOUNTRAD), $GUI_CHECKED) = $GUI_CHECKED Then
                $COMMAND = "/MOUNT"
            EndIf
        Case $nMsg = $MOUNTRWRAD
            If $MOUNTRWRAD And BitAND(GUICtrlRead($MOUNTRWRAD), $GUI_CHECKED) = $GUI_CHECKED Then
                $COMMAND = "/MOUNTRW"
            EndIf
        Case $nMsg = $INFORAD
            If $INFORAD And BitAND(GUICtrlRead($INFORAD), $GUI_CHECKED) = $GUI_CHECKED Then
                $COMMAND = "/INFO"
            EndIf
        Case $nMsg = $FONTRAD
            If $FONTRAD And BitAND(GUICtrlRead($FONTRAD), $GUI_CHECKED) = $GUI_CHECKED Then
                $COMPONENT = "/install=winpe-font*"
                GUICtrlSetState($SELNONECHK, $GUI_DISABLE)
                GUICtrlSetState($SELALLCHK, $GUI_DISABLE)
                _AddComponents()
                GUICtrlSetState($FONTRAD, $GUI_DISABLE)
                
            EndIf
        Case $nMsg = $HTARAD
            If $HTARAD And BitAND(GUICtrlRead($HTARAD), $GUI_CHECKED) = $GUI_CHECKED Then
                $COMPONENT = "/install=winpe-hta*"
                GUICtrlSetState($SELNONECHK, $GUI_DISABLE)
                GUICtrlSetState($SELALLCHK, $GUI_DISABLE)
                _AddComponents()
                GUICtrlSetState($HTARAD, $GUI_DISABLE)
                
            EndIf
        Case $nMsg = $MDACRAD
            If $MDACRAD And BitAND(GUICtrlRead($MDACRAD), $GUI_CHECKED) = $GUI_CHECKED Then
                $COMPONENT = "/install=winpe-mdac*"
                GUICtrlSetState($SELNONECHK, $GUI_DISABLE)
                GUICtrlSetState($SELALLCHK, $GUI_DISABLE)
                _AddComponents()
                GUICtrlSetState($MDACRAD, $GUI_DISABLE)
                
            EndIf
        Case $nMsg = $WMIRAD
            If $WMIRAD And BitAND(GUICtrlRead($WMIRAD), $GUI_CHECKED) = $GUI_CHECKED Then
                $COMPONENT = "/install=winpe-wmi*"
                GUICtrlSetState($SELNONECHK, $GUI_DISABLE)
                GUICtrlSetState($SELALLCHK, $GUI_DISABLE)
                _AddComponents()
                GUICtrlSetState($WMIRAD, $GUI_DISABLE)
                
            EndIf
        Case $nMsg = $SCRIPTINGRAD
            If $SCRIPTINGRAD And BitAND(GUICtrlRead($SCRIPTINGRAD), $GUI_CHECKED) = $GUI_CHECKED Then
                $COMPONENT = "/install=winpe-Scripting*"
                GUICtrlSetState($SELNONECHK, $GUI_DISABLE)
                GUICtrlSetState($SELALLCHK, $GUI_DISABLE)
                _AddComponents()
                GUICtrlSetState($SCRIPTINGRAD, $GUI_DISABLE)
                
            EndIf
        Case $nMsg = $XMLRAD
            If $XMLRAD And BitAND(GUICtrlRead($XMLRAD), $GUI_CHECKED) = $GUI_CHECKED Then
                $COMPONENT = "/install=winpe-xml*"
                GUICtrlSetState($SELNONECHK, $GUI_DISABLE)
                GUICtrlSetState($SELALLCHK, $GUI_DISABLE)
                _AddComponents()
                GUICtrlSetState($XMLRAD, $GUI_DISABLE)
                
            EndIf
        Case $nMsg = $SELALLCHK
            
            If $SELALLCHK And BitAND(GUICtrlRead($SELALLCHK), $GUI_CHECKED) = $GUI_CHECKED Then
                $COMPONENT = ""
                $COMPONENT = "/install=winpe*"
                GUICtrlSetState($SELNONECHK, $GUI_DISABLE) ;Disable the Select none Check box
                
                For $i = 0 To 5
                    
                    ; Enable all checkboxes once a succesful connection is made
                    GUICtrlSetState($check_array_WinPE_Comps[$i], $GUI_DISABLE)
                    
                Next
                _AddComponents()
                
                
            Else
                GUICtrlSetState($SELNONECHK, $GUI_ENABLE) ;Enable the Select none Check box
                For $i = 0 To 5
                    
                    ; Enable all checkboxes once a succesful connection is made
                    GUICtrlSetState($check_array_WinPE_Comps[$i], $GUI_ENABLE)
                    
                Next
                
            EndIf
            
            
        Case $nMsg = $SELNONECHK
            If $SELNONECHK And BitAND(GUICtrlRead($SELNONECHK), $GUI_CHECKED) = $GUI_CHECKED Then
                _DisableComponents() ;Disable all components
                GUICtrlSetState($CAPTUREBTN, $GUI_ENABLE)
            Else
                _EnableComponents() ;Enable all components
                GUICtrlSetState($CAPTUREBTN, $GUI_DISABLE)
            EndIf
    EndSwitch
    
    If $nMsg = $BRWSEBTN1 Then _BrowseforWaik()
    If $nMsg = $BRWSEBTN2 Then _BrowseforOutput()
    If $nMsg = $CREATEBTN Then _CreateStructure()
    If $nMsg = $MOUNTBTN Then _MountWIM()
    If $nMsg = $CAPTUREBTN Then _CaptureWIM()
    If $nMsg = $UNMOUNTBTN Then _UnMountWIM()
    If $nMsg = $CREATEISOBTN Then _CreateISOImage()
    If $nMsg = $RESETBTN Then _Resetall()
    If $nMsg = $CANCELBTN Then Exit
    
WEnd


Func _BrowseforWaik() ;Browse for WAIK folder
    
    Opt("WinWaitDelay", 1)
    WinActivate(AutoItWinGetTitle())
    WinSetState(AutoItWinGetTitle(), "", @SW_HIDE)
    
    $Browsemessage = "Location of PE Tools folder"
    
    $folder = FileSelectFolder($Browsemessage, "C:\Program Files\Windows AIK\Tools\PETools", 2)
    
    $Folderset = GUICtrlSetData($WAIKFLDR, $folder)

EndFunc   ;==>_BrowseforWaik

Func _BrowseforOutput() ;Browse for WAIK folder
    
    Opt("WinWaitDelay", 1)
    WinActivate(AutoItWinGetTitle())
    WinSetState(AutoItWinGetTitle(), "", @SW_HIDE)
    
    $Browsemessage = "Select an Output Folder"
    
    $folder = FileSelectFolder($Browsemessage, "", 5)
    
    $Folderset = GUICtrlSetData($OUTPUTFLDR, $folder)
    $Folderset = GUICtrlSetData($DSTFISOLDR & "\WinPECustom.iso", $folder)
    GUICtrlSetState($DSTFISOLDR, $GUI_DISABLE)
    
EndFunc   ;==>_BrowseforOutput

Func _CreateStructure() ;Create WinPE structure
    
    
    ; Check to see what fields are blank at runtime
    $WAIKPATHCHECK = GUICtrlRead($WAIKFLDR) <> ""
    $OUTPUTFLDRcheck = GUICtrlRead($OUTPUTFLDR) <> ""
    
    
    Select
        Case $WAIKPATHCHECK = 0
            MsgBox(262160, "Error", "WAIK Path not specified!")
            Return
            
        Case $OUTPUTFLDRcheck = 0
            MsgBox(262160, "Error", "Output folder not set!")
            Return
            
    EndSelect
    
    If $ARCH = "" Then
        MsgBox(262160, "Error", "Please choose Architecture type")
        Return
    EndIf
    
    $CHECKSTR = StringInStr(GUICtrlRead($OUTPUTFLDR), " ")
    
    If $CHECKSTR <> 0 Then
        MsgBox(16, "Error", "Please ensure you have no spaces in the output folder name")
        Return
    Else
        _CopyPE()
        
    EndIf
    
EndFunc   ;==>_CreateStructure


Func _CopyPE()
    
    $OUTPUTFLDRrslt = GUICtrlRead($OUTPUTFLDR)

    FileChangeDir($WAIKPETools)
    DirRemove($OUTPUTFLDRrslt)
    
    $COPYPETASK = RunWait('CopyPE.cmd ' & $ARCH & " " & $OUTPUTFLDRrslt, @WorkingDir, @SW_SHOW)
    ;$COPYPETASK = RunWait('CopyPE.cmd ' & $ARCH & ' "' & $OUTPUTFLDRrslt & '" ', @WorkingDir, @SW_SHOW)
    
    $ARCHinival = IniWrite($OUTPUTFLDRrslt & "\arch.ini", "ARCHITECTURE", "Type", $ARCH)
    GUICtrlSetData($CREATEBTN, "Complete!")
    GUICtrlSetState($MOUNTBTN, $GUI_ENABLE)
    GUICtrlSetState($MOUNTRAD, $GUI_ENABLE)
    GUICtrlSetState($MOUNTRWRAD, $GUI_ENABLE)
    GUICtrlSetState($WINIDCMBO, $GUI_ENABLE)
    GUICtrlSetState($INFORAD, $GUI_ENABLE)
    GUICtrlSetState($CREATEBTN, $GUI_DISABLE)
    GUICtrlSetState($ARCHx64RAD, $GUI_DISABLE)
    GUICtrlSetState($ARCHx86RAD, $GUI_DISABLE)
    GUICtrlSetState($OUTPUTFLDR, $GUI_DISABLE)
    GUICtrlSetState($BRWSEBTN2, $GUI_DISABLE)
    
    
EndFunc   ;==>_CopyPE

Func _MountWIM()

    $WIMID = GUICtrlRead($WINIDCMBO)
    
    ; Check to see what fields are blank at runtime
    $MOUNTRADcheck = GUICtrlRead($MOUNTRAD)
    $MOUNTRWRADcheck = GUICtrlRead($MOUNTRWRAD)
    $INFORADcheck = GUICtrlRead($INFORAD)
    
    If $MOUNTRADcheck = $GUI_CHECKED Then
        _MOUNTWIMTASK()
    ElseIf $MOUNTRWRADcheck = $GUI_CHECKED Then
        _MOUNTWIMTASK()
    ElseIf $INFORADcheck = $GUI_CHECKED Then
        _MOUNTWIMTASK()
    Else
        MsgBox(16, "Error", "Please select a MOUNT option")
    EndIf
    
    
EndFunc   ;==>_MountWIM

Func _MOUNTWIMTASK()
    $MOUNTWIMTASK = RunWait(@ComSpec & " /c " & $IMAGEXEXE & $COMMAND & " winpe.wim " & $WIMID & " mount", $OUTPUTFLDRrslt, @SW_SHOW)
    ;ClipPut($IMAGEXEXE & $COMMAND & " winpe.wim " & $WIMID & " mount" & $OUTPUTFLDRrslt
    
    GUICtrlSetData($MOUNTBTN, "Complete!")
    GUICtrlSetState($WINIDCMBO, $GUI_DISABLE)
    GUICtrlSetState($MOUNTBTN, $GUI_DISABLE)
    
    _EnableComponents() ;Enable all components
    
    GUICtrlSetState($MOUNTRAD, $GUI_DISABLE)
    GUICtrlSetState($MOUNTRWRAD, $GUI_DISABLE)
    GUICtrlSetState($INFORAD, $GUI_DISABLE)
EndFunc   ;==>_MOUNTWIMTASK

Func _AddComponents()
    
    If $COMPONENT = "" Then
        MsgBox(262160, "Error", "No Peimg options selected")
        Return
    Else
        $OUTPUTFLDRrslt = GUICtrlRead($OUTPUTFLDR)
        $PEIMGTASK = RunWait('Peimg ' & $COMPONENT & " mount\Windows", $OUTPUTFLDRrslt, @SW_SHOW)
        
    EndIf
    GUICtrlSetState($SELALLCHK, $GUI_DISABLE) ;Disable the Select All Check box
    GUICtrlSetState($CAPTUREBTN, $GUI_ENABLE)
EndFunc   ;==>_AddComponents


Func _CaptureWIM()
    
    
    If MsgBox(36, "Question?", 'Are all Customisations completed before the capture begins, ' & @CRLF & "such as editing the Starnet.cmd?") = $Yes Then

        _DisableComponents() ;Disable components
        
        $OUTPUTFLDRrslt = GUICtrlRead($OUTPUTFLDR)
        GUICtrlSetState($CAPTUREBTN, $GUI_DISABLE)
        $CAPTURETASK = RunWait($IMAGEXEXE & ' /boot /capture mount WinpeCustom.wim "Windows PE Custom Build"', $OUTPUTFLDRrslt, @SW_SHOW)
        
        
        GUICtrlSetState($UNMOUNTBTN, $GUI_ENABLE)
        MsgBox(64, "Info", "You can now import the newly created WIM file into WDS as a Boot image")
    Else
        Return
    EndIf
    
EndFunc   ;==>_CaptureWIM

Func _UnMountWIM()

    
    $OUTPUTFLDRrslt = GUICtrlRead($OUTPUTFLDR)
    $UNMOUNTWIMTASK = RunWait(@ComSpec & " /c " & $IMAGEXEXE & " /Unmount Mount", $OUTPUTFLDRrslt, @SW_SHOW)
    FileDelete($OUTPUTFLDRrslt & "\Winpe.wim")
    FileMove($OUTPUTFLDRrslt & "\WinpeCustom.wim", $OUTPUTFLDRrslt & "\Winpe.wim")
    
    GUICtrlSetData($MOUNTBTN, "Complete!")
    GUICtrlSetState($UNMOUNTBTN, $GUI_DISABLE)
    GUICtrlSetState($CREATEISOBTN, $GUI_ENABLE)

EndFunc   ;==>_UnMountWIM

Func _CreateISOImage()

    $OUTPUTFLDRrslt = GUICtrlRead($OUTPUTFLDR)
    $DSTFISOLDRrslt = GUICtrlRead($DSTFISOLDR)
    

    If MsgBox(36, "Info", "This will capture and create a Bootable ISO Image" & @CRLF & "Begin ISO image creation process?") = $Yes Then
        RunWait('OSCDIMG -n -b' & $OUTPUTFLDRrslt & "\etfsboot.com " & $OUTPUTFLDRrslt & "\iso " & $DSTFISOLDRrslt & "\WinPECustom.iso", $OUTPUTFLDRrslt, @SW_SHOW)
        MsgBox(64, "Success!", "ISO Image successfully created in " & $DSTFISOLDRrslt)
        GUICtrlSetState($CREATEISOBTN, $GUI_DISABLE)
    Else
        Return
    EndIf

EndFunc   ;==>_CreateISOImage


Func _Resetall()

    $OUTPUTFLDRrslt = GUICtrlRead($OUTPUTFLDR)
    $ARCH = IniRead($OUTPUTFLDRrslt & "\arch.ini", "ARCHITECTURE", "Type", "Notfound")
    
    $IMAGEXEXE = '"C:\Program Files\Windows AIK\Tools\' & $ARCH & '\Imagex.exe"'
    

    If $OUTPUTFLDRrslt <> "" Then
        
        If FileExists($OUTPUTFLDRrslt & "\Mount\Windows\") Then
            $UNMOUNTWIMTASK = RunWait($IMAGEXEXE & " /Unmount mount", $OUTPUTFLDRrslt, @SW_SHOW)
        EndIf
        DirRemove($OUTPUTFLDRrslt, 1) ;Remove existing WinPE Folder
        MsgBox(48, "Removed", "WinPE Folder Structure deleted..")
        GUICtrlSetData($OUTPUTFLDR, "") ;Clear the WinPE Folder path
        GUICtrlSetData($DSTFISOLDR, "") ;Clear the Destination ISO Folder path
        GUICtrlSetState($SELALLCHK, $GUI_ENABLE)
        
        If GUICtrlRead($ARCHx64RAD) = $GUI_CHECKED Then GUICtrlSetState($ARCHx64RAD, $GUI_UNCHECKED)
        If GUICtrlRead($ARCHx86RAD) = $GUI_CHECKED Then GUICtrlSetState($ARCHx86RAD, $GUI_UNCHECKED)

    Else
        MsgBox(48, "WinPE", "No Structure found to delete")
        
    EndIf
EndFunc   ;==>_Resetall

Func _DisableComponents()
    
    For $i = 0 To 6
        
        ; Disable all checkboxes once a succesful connection is made
        GUICtrlSetState($check_array_WinPE_Comps[$i], $GUI_DISABLE)
        
    Next
EndFunc   ;==>_DisableComponents

Func _EnableComponents()
    
    For $i = 0 To 7
        
        ; Disable all checkboxes once a succesful connection is made
        GUICtrlSetState($check_array_WinPE_Comps[$i], $GUI_ENABLE)
        
    Next
EndFunc   ;==>_EnableComponents
Edited by lyledg

Share this post


Link to post
Share on other sites
lordofthestrings

this tool looks nice, I'm downloading the WAIK as we speak.. can you please post source?

well normally in this forum people only post things with source..

Thanks in advance,


Share this post


Link to post
Share on other sites
lordofthestrings

Ok, after some testing, this is pretty fancy..

you chose a nice and clear layout. Not too much to configure.. No more typing..

Only thing I would try adding (and I'll help you with this if you like) is making a plugin tab-page..

example:

- instead of launching CMD.EXE launch a file explorer or a script. (preferably script from somewhere over the network, so that support staff doesn't need to reburn CD's and CD's)

- if I want to add my own tools to PE, how do I do this? This tool can easily take care of all this also (when wim file are mounted)

the world is ruled by lazy people...


Share this post


Link to post
Share on other sites
lyledg

Thanks for the reply and comments!

1) This is a valid point, but I would want to remove the network option as creating file structure's over a network can lead to issues as network dropout's etc can occur..

2) The WinPE tools I guess would have to be another TAB and have a path to additional tools..I will have to work on that

3) Also, i have been thinking of adding suppport for WinPE 2005, as I need that too in my current development

Watch this space..

Cheers

Edited by lyledg

Share this post


Link to post
Share on other sites
lyledg

Update:

I am currently working on enhancing this tool, with added support for WinPE 2004\2005, driver injection and ISO creation...

Cheers

Share this post


Link to post
Share on other sites
ALEXG

how do i get a copy of the .exe ? thanks

I wrote this to to get around the constant command lines needed to mount, create and customise the WIM file for use with WinPE 2.0

Unzip, Run the EXE. Attached is a help file with screenshots.

Hopefully someone finds this useful..

Cheers

lyledg

Source Code:

#include <GUIConstants.au3>



Global $WAIKPETools, $OUTPUTFLDRrslt, $COMPONENT, $Yes = 6, $No = 7, $retry = 4, $Cancel = 2, $filename, $IMAGEXEXE
Dim $ARCH, $WAIKPATHCHECK, $RUNTASK, $COMMAND, $element, $i, $MOUNTRADcheck, $MOUNTRWRADcheck, $INFORADcheck, $MOUNTRAD, $MOUNTRWAD, $INFORAD, $WIMID

#Region ### START Koda GUI section ### Form=e:\_development work\_scripts\_wiim manager\wimm.kxf
$MAINFORM = GUICreate("WinPE 2.0 Customisation Manager", 664, 444, @DesktopWidth / 2 - 332, @DesktopHeight / 2 - 222)

GUISetIcon("D:05.ico")
$PageControl1 = GUICtrlCreateTab(8, 8, 650, 424)
$TabSheet2 = GUICtrlCreateTabItem("Customise Winpe 2.0")
$Group4 = GUICtrlCreateGroup("1) &Create WinPE Structure", 20, 40, 313, 225)
$Label3 = GUICtrlCreateLabel("WAIK folder path:", 35, 69, 88, 17)
$WAIKFLDR = GUICtrlCreateInput("", 32, 88, 281, 21)
$BRWSEBTN1 = GUICtrlCreateButton("&Browse", 253, 116, 49, 17, 0)
$Label4 = GUICtrlCreateLabel("Select Output folder:", 34, 132, 122, 17)
$OUTPUTFLDR = GUICtrlCreateInput("", 33, 160, 281, 21)
GUICtrlSetTip(-1, "Output folder path goes here")
$BRWSEBTN2 = GUICtrlCreateButton("&Browse", 252, 186, 49, 17, 0)
GUICtrlSetTip(-1, "Browse for output folder")
$Label5 = GUICtrlCreateLabel("Architecture Type:", 36, 219, 91, 17)
GUICtrlSetTip(-1, "Choose an Architecure type you are customising for")
$ARCHx64RAD = GUICtrlCreateRadio("x64", 187, 218, 41, 17)
$ARCHx86RAD = GUICtrlCreateRadio("x86", 134, 218, 41, 17)
$CREATEBTN = GUICtrlCreateButton("&Create", 252, 238, 65, 21, 0)
GUICtrlCreateGroup("", -99, -99, 1, 1)
$Group6 = GUICtrlCreateGroup("2) Mount WIM File", 20, 272, 313, 145)
$Label1 = GUICtrlCreateLabel("WIM Image ID: ", 34, 301, 79, 17)
$WINIDCMBO = GUICtrlCreateCombo("", 131, 299, 81, 25, $CBS_DROPDOWNLIST)
GUICtrlSetData(-1, "1|2|3|4|5|6|7|8", "1")
GUICtrlSetState($WINIDCMBO, $GUI_DISABLE)
$Group1 = GUICtrlCreateGroup("ImageX options", 32, 333, 281, 49)
;$INFORAD = GUICtrlCreateRadio(" /INFO", 208, 355, 57, 17)
;GUICtrlSetState(-1, $GUI_DISABLE)
$MOUNTRAD = GUICtrlCreateRadio(" /MOUNT", 40, 355, 65, 17)
GUICtrlSetState(-1, $GUI_DISABLE)
$MOUNTRWRAD = GUICtrlCreateRadio(" /MOUNTRW", 114, 355, 89, 17)
GUICtrlSetState(-1, $GUI_DISABLE)
GUICtrlCreateGroup("", -99, -99, 1, 1)
$MOUNTBTN = GUICtrlCreateButton("&Mount", 252, 391, 65, 21, 0)
GUICtrlSetState(-1, $GUI_DISABLE)
GUICtrlCreateGroup("", -99, -99, 1, 1)
$Group2 = GUICtrlCreateGroup("3) Peimg Options", 340, 42, 310, 100)
$FONTRAD = GUICtrlCreateRadio("WinPE-Font Support", 348, 80, 121, 17)
GUICtrlSetState(-1, $GUI_DISABLE)
$HTARAD = GUICtrlCreateRadio("WinPE-HTA-Package", 348, 100, 129, 17)
GUICtrlSetState(-1, $GUI_DISABLE)
$MDACRAD = GUICtrlCreateRadio("WinPE-MDAC-Package", 348, 120, 137, 17)
GUICtrlSetState(-1, $GUI_DISABLE)
$WMIRAD = GUICtrlCreateRadio("WinPE-WMI-Package", 495, 82, 129, 17)
GUICtrlSetState(-1, $GUI_DISABLE)
$SCRIPTINGRAD = GUICtrlCreateRadio("WinPE-Scripting-Package", 495, 121, 145, 17)
GUICtrlSetState(-1, $GUI_DISABLE)
$XMLRAD = GUICtrlCreateRadio("WinPE-XML-Package", 495, 102, 129, 17)
GUICtrlSetState(-1, $GUI_DISABLE)
$SELNONECHK = GUICtrlCreateCheckbox("Select None", 480, 55, 80, 17)
GUICtrlSetState(-1, $GUI_DISABLE)
$SELALLCHK = GUICtrlCreateCheckbox("Select All", 570, 55, 65, 17)
GUICtrlSetState(-1, $GUI_DISABLE)
GUICtrlCreateGroup("", -99, -99, 1, 1)
$Group4 = GUICtrlCreateGroup("4) Capture WIM", 340, 145, 310, 75)
$CAPTURELBL = GUICtrlCreateLabel("Once all customisations are complete, capture and create WIM file:", 352, 165, 250, 25)
$CAPTUREBTN = GUICtrlCreateButton("&Capture changes", 545, 193, 90, 21, 0)
GUICtrlSetState(-1, $GUI_DISABLE)
$Group7 = GUICtrlCreateGroup("5) ISO Image creation", 340, 225, 310, 160)
$Label2 = GUICtrlCreateLabel("Unmount WIM file for ISO Image creation:", 352, 248, 200, 17)
$UNMOUNTBTN = GUICtrlCreateButton("&Unmount WIM", 560, 245, 75, 21, 0)
GUICtrlSetState(-1, $GUI_DISABLE)
$Label6 = GUICtrlCreateLabel("Destination ISO folder", 356, 275, 107, 17)
$DSTFISOLDR = GUICtrlCreateInput("", 358, 300, 273, 21)
GUICtrlSetState(-1, $GUI_DISABLE)
$CREATEISOBTN = GUICtrlCreateButton("&Create ISO", 560, 340, 73, 21, 0)
GUICtrlSetState(-1, $GUI_DISABLE)
GUICtrlCreateGroup("", -99, -99, 1, 1)
GUICtrlCreateTabItem("")

$RESETBTN = GUICtrlCreateButton("Reset all", 480, 395, 73, 21, 0)
$CANCELBTN = GUICtrlCreateButton("Cancel", 570, 395, 73, 21, 0)
Global $check_array_WinPE_Comps[8]
Global $Reset_array_[7]


$check_array_WinPE_Comps[0] = $FONTRAD
$check_array_WinPE_Comps[1] = $HTARAD
$check_array_WinPE_Comps[2] = $MDACRAD
$check_array_WinPE_Comps[3] = $WMIRAD
$check_array_WinPE_Comps[4] = $SCRIPTINGRAD
$check_array_WinPE_Comps[5] = $XMLRAD
$check_array_WinPE_Comps[6] = $SELALLCHK
$check_array_WinPE_Comps[7] = $SELNONECHK



$Reset_array_[0] = $OUTPUTFLDR
$Reset_array_[1] = $BRWSEBTN2
$Reset_array_[2] = $ARCHx64RAD
$Reset_array_[3] = $ARCHx86RAD
$Reset_array_[4] = $CREATEBTN
$Reset_array_[5] = $DSTFISOLDR


GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###


MsgBox(64, "Info", "Please ensure the Microsoft WAIK is installed " & @CRLF & "to it's default path before running this tool.")


If FileExists("C:\Program Files\Windows AIK") Then
    $WAIKPETools = "C:\Program Files\Windows AIK\Tools\PETools\"
    GUICtrlSetData($WAIKFLDR, $WAIKPETools)
    GUICtrlSetState($WAIKFLDR, $GUI_DISABLE)
    GUICtrlSetState($BRWSEBTN1, $GUI_DISABLE)
    $WAIKTools = "C:\Program Files\Windows AIK\Tools\"
    
EndIf



While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE
            Exit
        Case $nMsg = $ARCHx64RAD
            If $ARCHx64RAD And BitAND(GUICtrlRead($ARCHx64RAD), $GUI_CHECKED) = $GUI_CHECKED Then
                $ARCH = "amd64"
                $IMAGEXEXE = '"C:\Program Files\Windows AIK\Tools\' & $ARCH & '\Imagex.exe"'
                
            EndIf
        Case $nMsg = $ARCHx86RAD
            If $ARCHx86RAD And BitAND(GUICtrlRead($ARCHx86RAD), $GUI_CHECKED) = $GUI_CHECKED Then
                $ARCH = "x86"
                $IMAGEXEXE = '"C:\Program Files\Windows AIK\Tools\' & $ARCH & '\Imagex.exe"'
                
            EndIf
        Case $nMsg = $MOUNTRAD
            If $MOUNTRAD And BitAND(GUICtrlRead($MOUNTRAD), $GUI_CHECKED) = $GUI_CHECKED Then
                $COMMAND = "/MOUNT"
            EndIf
        Case $nMsg = $MOUNTRWRAD
            If $MOUNTRWRAD And BitAND(GUICtrlRead($MOUNTRWRAD), $GUI_CHECKED) = $GUI_CHECKED Then
                $COMMAND = "/MOUNTRW"
            EndIf
        Case $nMsg = $INFORAD
            If $INFORAD And BitAND(GUICtrlRead($INFORAD), $GUI_CHECKED) = $GUI_CHECKED Then
                $COMMAND = "/INFO"
            EndIf
        Case $nMsg = $FONTRAD
            If $FONTRAD And BitAND(GUICtrlRead($FONTRAD), $GUI_CHECKED) = $GUI_CHECKED Then
                $COMPONENT = "/install=winpe-font*"
                GUICtrlSetState($SELNONECHK, $GUI_DISABLE)
                GUICtrlSetState($SELALLCHK, $GUI_DISABLE)
                _AddComponents()
                GUICtrlSetState($FONTRAD, $GUI_DISABLE)
                
            EndIf
        Case $nMsg = $HTARAD
            If $HTARAD And BitAND(GUICtrlRead($HTARAD), $GUI_CHECKED) = $GUI_CHECKED Then
                $COMPONENT = "/install=winpe-hta*"
                GUICtrlSetState($SELNONECHK, $GUI_DISABLE)
                GUICtrlSetState($SELALLCHK, $GUI_DISABLE)
                _AddComponents()
                GUICtrlSetState($HTARAD, $GUI_DISABLE)
                
            EndIf
        Case $nMsg = $MDACRAD
            If $MDACRAD And BitAND(GUICtrlRead($MDACRAD), $GUI_CHECKED) = $GUI_CHECKED Then
                $COMPONENT = "/install=winpe-mdac*"
                GUICtrlSetState($SELNONECHK, $GUI_DISABLE)
                GUICtrlSetState($SELALLCHK, $GUI_DISABLE)
                _AddComponents()
                GUICtrlSetState($MDACRAD, $GUI_DISABLE)
                
            EndIf
        Case $nMsg = $WMIRAD
            If $WMIRAD And BitAND(GUICtrlRead($WMIRAD), $GUI_CHECKED) = $GUI_CHECKED Then
                $COMPONENT = "/install=winpe-wmi*"
                GUICtrlSetState($SELNONECHK, $GUI_DISABLE)
                GUICtrlSetState($SELALLCHK, $GUI_DISABLE)
                _AddComponents()
                GUICtrlSetState($WMIRAD, $GUI_DISABLE)
                
            EndIf
        Case $nMsg = $SCRIPTINGRAD
            If $SCRIPTINGRAD And BitAND(GUICtrlRead($SCRIPTINGRAD), $GUI_CHECKED) = $GUI_CHECKED Then
                $COMPONENT = "/install=winpe-Scripting*"
                GUICtrlSetState($SELNONECHK, $GUI_DISABLE)
                GUICtrlSetState($SELALLCHK, $GUI_DISABLE)
                _AddComponents()
                GUICtrlSetState($SCRIPTINGRAD, $GUI_DISABLE)
                
            EndIf
        Case $nMsg = $XMLRAD
            If $XMLRAD And BitAND(GUICtrlRead($XMLRAD), $GUI_CHECKED) = $GUI_CHECKED Then
                $COMPONENT = "/install=winpe-xml*"
                GUICtrlSetState($SELNONECHK, $GUI_DISABLE)
                GUICtrlSetState($SELALLCHK, $GUI_DISABLE)
                _AddComponents()
                GUICtrlSetState($XMLRAD, $GUI_DISABLE)
                
            EndIf
        Case $nMsg = $SELALLCHK
            
            If $SELALLCHK And BitAND(GUICtrlRead($SELALLCHK), $GUI_CHECKED) = $GUI_CHECKED Then
                $COMPONENT = ""
                $COMPONENT = "/install=winpe*"
                GUICtrlSetState($SELNONECHK, $GUI_DISABLE) ;Disable the Select none Check box
                
                For $i = 0 To 5
                    
                    ; Enable all checkboxes once a succesful connection is made
                    GUICtrlSetState($check_array_WinPE_Comps[$i], $GUI_DISABLE)
                    
                Next
                _AddComponents()
                
                
            Else
                GUICtrlSetState($SELNONECHK, $GUI_ENABLE) ;Enable the Select none Check box
                For $i = 0 To 5
                    
                    ; Enable all checkboxes once a succesful connection is made
                    GUICtrlSetState($check_array_WinPE_Comps[$i], $GUI_ENABLE)
                    
                Next
                
            EndIf
            
            
        Case $nMsg = $SELNONECHK
            If $SELNONECHK And BitAND(GUICtrlRead($SELNONECHK), $GUI_CHECKED) = $GUI_CHECKED Then
                _DisableComponents() ;Disable all components
                GUICtrlSetState($CAPTUREBTN, $GUI_ENABLE)
            Else
                _EnableComponents() ;Enable all components
                GUICtrlSetState($CAPTUREBTN, $GUI_DISABLE)
            EndIf
    EndSwitch
    
    If $nMsg = $BRWSEBTN1 Then _BrowseforWaik()
    If $nMsg = $BRWSEBTN2 Then _BrowseforOutput()
    If $nMsg = $CREATEBTN Then _CreateStructure()
    If $nMsg = $MOUNTBTN Then _MountWIM()
    If $nMsg = $CAPTUREBTN Then _CaptureWIM()
    If $nMsg = $UNMOUNTBTN Then _UnMountWIM()
    If $nMsg = $CREATEISOBTN Then _CreateISOImage()
    If $nMsg = $RESETBTN Then _Resetall()
    If $nMsg = $CANCELBTN Then Exit
    
WEnd


Func _BrowseforWaik() ;Browse for WAIK folder
    
    Opt("WinWaitDelay", 1)
    WinActivate(AutoItWinGetTitle())
    WinSetState(AutoItWinGetTitle(), "", @SW_HIDE)
    
    $Browsemessage = "Location of PE Tools folder"
    
    $folder = FileSelectFolder($Browsemessage, "C:\Program Files\Windows AIK\Tools\PETools", 2)
    
    $Folderset = GUICtrlSetData($WAIKFLDR, $folder)

EndFunc   ;==>_BrowseforWaik

Func _BrowseforOutput() ;Browse for WAIK folder
    
    Opt("WinWaitDelay", 1)
    WinActivate(AutoItWinGetTitle())
    WinSetState(AutoItWinGetTitle(), "", @SW_HIDE)
    
    $Browsemessage = "Select an Output Folder"
    
    $folder = FileSelectFolder($Browsemessage, "", 5)
    
    $Folderset = GUICtrlSetData($OUTPUTFLDR, $folder)
    $Folderset = GUICtrlSetData($DSTFISOLDR & "\WinPECustom.iso", $folder)
    GUICtrlSetState($DSTFISOLDR, $GUI_DISABLE)
    
EndFunc   ;==>_BrowseforOutput

Func _CreateStructure() ;Create WinPE structure
    
    
    ; Check to see what fields are blank at runtime
    $WAIKPATHCHECK = GUICtrlRead($WAIKFLDR) <> ""
    $OUTPUTFLDRcheck = GUICtrlRead($OUTPUTFLDR) <> ""
    
    
    Select
        Case $WAIKPATHCHECK = 0
            MsgBox(262160, "Error", "WAIK Path not specified!")
            Return
            
        Case $OUTPUTFLDRcheck = 0
            MsgBox(262160, "Error", "Output folder not set!")
            Return
            
    EndSelect
    
    If $ARCH = "" Then
        MsgBox(262160, "Error", "Please choose Architecture type")
        Return
    EndIf
    
    $CHECKSTR = StringInStr(GUICtrlRead($OUTPUTFLDR), " ")
    
    If $CHECKSTR <> 0 Then
        MsgBox(16, "Error", "Please ensure you have no spaces in the output folder name")
        Return
    Else
        _CopyPE()
        
    EndIf
    
EndFunc   ;==>_CreateStructure


Func _CopyPE()
    
    $OUTPUTFLDRrslt = GUICtrlRead($OUTPUTFLDR)

    FileChangeDir($WAIKPETools)
    DirRemove($OUTPUTFLDRrslt)
    
    $COPYPETASK = RunWait('CopyPE.cmd ' & $ARCH & " " & $OUTPUTFLDRrslt, @WorkingDir, @SW_SHOW)
    ;$COPYPETASK = RunWait('CopyPE.cmd ' & $ARCH & ' "' & $OUTPUTFLDRrslt & '" ', @WorkingDir, @SW_SHOW)
    
    $ARCHinival = IniWrite($OUTPUTFLDRrslt & "\arch.ini", "ARCHITECTURE", "Type", $ARCH)
    GUICtrlSetData($CREATEBTN, "Complete!")
    GUICtrlSetState($MOUNTBTN, $GUI_ENABLE)
    GUICtrlSetState($MOUNTRAD, $GUI_ENABLE)
    GUICtrlSetState($MOUNTRWRAD, $GUI_ENABLE)
    GUICtrlSetState($WINIDCMBO, $GUI_ENABLE)
    GUICtrlSetState($INFORAD, $GUI_ENABLE)
    GUICtrlSetState($CREATEBTN, $GUI_DISABLE)
    GUICtrlSetState($ARCHx64RAD, $GUI_DISABLE)
    GUICtrlSetState($ARCHx86RAD, $GUI_DISABLE)
    GUICtrlSetState($OUTPUTFLDR, $GUI_DISABLE)
    GUICtrlSetState($BRWSEBTN2, $GUI_DISABLE)
    
    
EndFunc   ;==>_CopyPE

Func _MountWIM()

    $WIMID = GUICtrlRead($WINIDCMBO)
    
    ; Check to see what fields are blank at runtime
    $MOUNTRADcheck = GUICtrlRead($MOUNTRAD)
    $MOUNTRWRADcheck = GUICtrlRead($MOUNTRWRAD)
    $INFORADcheck = GUICtrlRead($INFORAD)
    
    If $MOUNTRADcheck = $GUI_CHECKED Then
        _MOUNTWIMTASK()
    ElseIf $MOUNTRWRADcheck = $GUI_CHECKED Then
        _MOUNTWIMTASK()
    ElseIf $INFORADcheck = $GUI_CHECKED Then
        _MOUNTWIMTASK()
    Else
        MsgBox(16, "Error", "Please select a MOUNT option")
    EndIf
    
    
EndFunc   ;==>_MountWIM

Func _MOUNTWIMTASK()
    $MOUNTWIMTASK = RunWait(@ComSpec & " /c " & $IMAGEXEXE & $COMMAND & " winpe.wim " & $WIMID & " mount", $OUTPUTFLDRrslt, @SW_SHOW)
    ;ClipPut($IMAGEXEXE & $COMMAND & " winpe.wim " & $WIMID & " mount" & $OUTPUTFLDRrslt
    
    GUICtrlSetData($MOUNTBTN, "Complete!")
    GUICtrlSetState($WINIDCMBO, $GUI_DISABLE)
    GUICtrlSetState($MOUNTBTN, $GUI_DISABLE)
    
    _EnableComponents() ;Enable all components
    
    GUICtrlSetState($MOUNTRAD, $GUI_DISABLE)
    GUICtrlSetState($MOUNTRWRAD, $GUI_DISABLE)
    GUICtrlSetState($INFORAD, $GUI_DISABLE)
EndFunc   ;==>_MOUNTWIMTASK

Func _AddComponents()
    
    If $COMPONENT = "" Then
        MsgBox(262160, "Error", "No Peimg options selected")
        Return
    Else
        $OUTPUTFLDRrslt = GUICtrlRead($OUTPUTFLDR)
        $PEIMGTASK = RunWait('Peimg ' & $COMPONENT & " mount\Windows", $OUTPUTFLDRrslt, @SW_SHOW)
        
    EndIf
    GUICtrlSetState($SELALLCHK, $GUI_DISABLE) ;Disable the Select All Check box
    GUICtrlSetState($CAPTUREBTN, $GUI_ENABLE)
EndFunc   ;==>_AddComponents


Func _CaptureWIM()
    
    
    If MsgBox(36, "Question?", 'Are all Customisations completed before the capture begins, ' & @CRLF & "such as editing the Starnet.cmd?") = $Yes Then

        _DisableComponents() ;Disable components
        
        $OUTPUTFLDRrslt = GUICtrlRead($OUTPUTFLDR)
        GUICtrlSetState($CAPTUREBTN, $GUI_DISABLE)
        $CAPTURETASK = RunWait($IMAGEXEXE & ' /boot /capture mount WinpeCustom.wim "Windows PE Custom Build"', $OUTPUTFLDRrslt, @SW_SHOW)
        
        
        GUICtrlSetState($UNMOUNTBTN, $GUI_ENABLE)
        MsgBox(64, "Info", "You can now import the newly created WIM file into WDS as a Boot image")
    Else
        Return
    EndIf
    
EndFunc   ;==>_CaptureWIM

Func _UnMountWIM()

    
    $OUTPUTFLDRrslt = GUICtrlRead($OUTPUTFLDR)
    $UNMOUNTWIMTASK = RunWait(@ComSpec & " /c " & $IMAGEXEXE & " /Unmount Mount", $OUTPUTFLDRrslt, @SW_SHOW)
    FileDelete($OUTPUTFLDRrslt & "\Winpe.wim")
    FileMove($OUTPUTFLDRrslt & "\WinpeCustom.wim", $OUTPUTFLDRrslt & "\Winpe.wim")
    
    GUICtrlSetData($MOUNTBTN, "Complete!")
    GUICtrlSetState($UNMOUNTBTN, $GUI_DISABLE)
    GUICtrlSetState($CREATEISOBTN, $GUI_ENABLE)

EndFunc   ;==>_UnMountWIM

Func _CreateISOImage()

    $OUTPUTFLDRrslt = GUICtrlRead($OUTPUTFLDR)
    $DSTFISOLDRrslt = GUICtrlRead($DSTFISOLDR)
    

    If MsgBox(36, "Info", "This will capture and create a Bootable ISO Image" & @CRLF & "Begin ISO image creation process?") = $Yes Then
        RunWait('OSCDIMG -n -b' & $OUTPUTFLDRrslt & "\etfsboot.com " & $OUTPUTFLDRrslt & "\iso " & $DSTFISOLDRrslt & "\WinPECustom.iso", $OUTPUTFLDRrslt, @SW_SHOW)
        MsgBox(64, "Success!", "ISO Image successfully created in " & $DSTFISOLDRrslt)
        GUICtrlSetState($CREATEISOBTN, $GUI_DISABLE)
    Else
        Return
    EndIf

EndFunc   ;==>_CreateISOImage


Func _Resetall()

    $OUTPUTFLDRrslt = GUICtrlRead($OUTPUTFLDR)
    $ARCH = IniRead($OUTPUTFLDRrslt & "\arch.ini", "ARCHITECTURE", "Type", "Notfound")
    
    $IMAGEXEXE = '"C:\Program Files\Windows AIK\Tools\' & $ARCH & '\Imagex.exe"'
    

    If $OUTPUTFLDRrslt <> "" Then
        
        If FileExists($OUTPUTFLDRrslt & "\Mount\Windows\") Then
            $UNMOUNTWIMTASK = RunWait($IMAGEXEXE & " /Unmount mount", $OUTPUTFLDRrslt, @SW_SHOW)
        EndIf
        DirRemove($OUTPUTFLDRrslt, 1) ;Remove existing WinPE Folder
        MsgBox(48, "Removed", "WinPE Folder Structure deleted..")
        GUICtrlSetData($OUTPUTFLDR, "") ;Clear the WinPE Folder path
        GUICtrlSetData($DSTFISOLDR, "") ;Clear the Destination ISO Folder path
        GUICtrlSetState($SELALLCHK, $GUI_ENABLE)
        
        If GUICtrlRead($ARCHx64RAD) = $GUI_CHECKED Then GUICtrlSetState($ARCHx64RAD, $GUI_UNCHECKED)
        If GUICtrlRead($ARCHx86RAD) = $GUI_CHECKED Then GUICtrlSetState($ARCHx86RAD, $GUI_UNCHECKED)

    Else
        MsgBox(48, "WinPE", "No Structure found to delete")
        
    EndIf
EndFunc   ;==>_Resetall

Func _DisableComponents()
    
    For $i = 0 To 6
        
        ; Disable all checkboxes once a succesful connection is made
        GUICtrlSetState($check_array_WinPE_Comps[$i], $GUI_DISABLE)
        
    Next
EndFunc   ;==>_DisableComponents

Func _EnableComponents()
    
    For $i = 0 To 7
        
        ; Disable all checkboxes once a succesful connection is made
        GUICtrlSetState($check_array_WinPE_Comps[$i], $GUI_ENABLE)
        
    Next
EndFunc   ;==>_EnableComponents

Share this post


Link to post
Share on other sites
MadBoy

If you want only the .exe and a bit more functionality you can check my version of customization manager for WinPE at this Link (there's no source available thou).


My little company: Evotec (PL version: Evotec)

Share this post


Link to post
Share on other sites
VB6Rules

WinPE is a custom Windows environment what exactly...

Share this post


Link to post
Share on other sites
nkono

Hi lyledg (sorry for my bad english)

This is a nice job, but you have made some errors

1 - In the variables path you have to use < @ProgramFilesDir > Instead of "C:\Program Files", because in other languages this directory have another name!

2 - RunWait('OSCDIMG -n -b' & $OUTPUTFLDRrslt & "\etfsboot.com " & $OUTPUTFLDRrslt & "\iso " & $DSTFISOLDRrslt & "\WinPECustom.iso", OUTPUTFLDRrslt, @SW_SHOW) in the function _CreateISOImage() generate this error: Unable to execute the external program.

I have tested your application in MSFN Forum (winpe_made_easy_1.0.0.2.exe) and even this generate a error probably because you have used "C:\Program Files" instead of the environment variable.

I am interested in this project and i want to test it in deep

Thanks

Share this post


Link to post
Share on other sites
MadBoy

I have tested your application in MSFN Forum (winpe_made_easy_1.0.0.2.exe) and even this generate a error probably because you have used "C:\Program Files" instead of the environment variable.

I am interested in this project and i want to test it in deep

Thanks

Hello nkono. The WinPE Made Easy on MSFN forum isn't lyledg app but mine. Can you msg me what error do you get when creating things with that newest version? I'm not using hardcoded variables there. It takes values from what you type in the window. Lemme know what errors you get and i'll try to investigate. Thought i've fixed this in 1.0.0.2. Have you explicitly installed WAIK to some path or have you copied the dir?


My little company: Evotec (PL version: Evotec)

Share this post


Link to post
Share on other sites
nkono

Sorry for this MadBoy :) but i haven't look the nickname.

The error by winpe_made_easy_1.0.0.2.exe is in this image: WinPE Error

I have installed the last WAIK in the default path.

Thanks

Share this post


Link to post
Share on other sites
MadBoy

Sorry for this MadBoy :) but i haven't look the nickname.

The error by winpe_made_easy_1.0.0.2.exe is in this image: WinPE Error

I have installed the last WAIK in the default path.

Thanks

Can you list me the full structure that you have in that directory.. i mean all subdirectories to that path.. My program assumes some sub directories so maybe it did some assumption wrong. DId you install 2.1 or 2.0 ?


My little company: Evotec (PL version: Evotec)

Share this post


Link to post
Share on other sites
nkono

Hi lyledg

I have added two lines at your source:

added a global variable $OSCDIMGEXE

and

Case $nMsg = $ARCHx64RAD
            If $ARCHx64RAD And BitAND(GUICtrlRead($ARCHx64RAD), $GUI_CHECKED) = $GUI_CHECKED Then
                $ARCH = "amd64"
                $IMAGEXEXE = '"' & @ProgramFilesDir & '\Windows AIK\Tools\' & $ARCH & '\Imagex.exe"'
                $OSCDIMGEXE = '"' & @ProgramFilesDir & '\Windows AIK\Tools' & $ARCH & '\oscdimg.exe"'
            EndIf
        Case $nMsg = $ARCHx86RAD
            If $ARCHx86RAD And BitAND(GUICtrlRead($ARCHx86RAD), $GUI_CHECKED) = $GUI_CHECKED Then
                $ARCH = "x86"
                $IMAGEXEXE = '"' & @ProgramFilesDir & '\Windows AIK\Tools\' & $ARCH & '\Imagex.exe"'
                $OSCDIMGEXE = '"' & @ProgramFilesDir & '\Windows AIK\Tools\' & $ARCH & '\oscdimg.exe"'
            EndIfoÝ÷ Ù§íz»aÈ¡j÷¦¡ØçmçîËb¢p«y«^!#¨jëh×6Func _CreateISOImage()
    $OUTPUTFLDRrslt = GUICtrlRead($OUTPUTFLDR)
    $DSTFISOLDRrslt = GUICtrlRead($DSTFISOLDR)
    If MsgBox(36, "Info", "This will capture and create a Bootable ISO Image" & @CRLF & "Begin ISO image creation process?") = $Yes Then
        RunWait($OSCDIMGEXE & " -n -b" & $OUTPUTFLDRrslt & "\etfsboot.com " & $OUTPUTFLDRrslt & "\iso " & $DSTFISOLDRrslt & "\WinPECustom.iso", $OUTPUTFLDRrslt, @SW_SHOW)
        MsgBox(64, "Success!", "ISO Image successfully created in " & $DSTFISOLDRrslt)
        GUICtrlSetState($CREATEISOBTN, $GUI_DISABLE)
    Else
        Return
    EndIf
EndFunc   ;==>_CreateISOImage

because the file oscdimg.exe isn't in directory PETools.

Now the app works fine

:)

Share this post


Link to post
Share on other sites
MadBoy

nkono... please test it with the full path to WAIK but also add Tools\PETools.

So instead C:\Program Files\Windows AIK put C:\Program Files\Windows AIK\Tools\PETools (change accordingly to your lang version). Version 1.0.0.0 an 1.0.0.2 makes that assumption. I'll fix it in 1.0.0.3 (well i already did).


My little company: Evotec (PL version: Evotec)

Share this post


Link to post
Share on other sites
MadBoy

nkono please download the 1.0.0.3. The old version had some code accidentally cut out so it wouldn't work :/


My little company: Evotec (PL version: Evotec)

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.