# cadubarbosabr/windows10wimclone architecture

> Architecture diagram of the GitHub repository cadubarbosabr/windows10wimclone, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-03-31). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/cadubarbosabr/windows10wimclone
- Repository: https://github.com/cadubarbosabr/windows10wimclone

## Overview

##### Project's Purpose and Components
- The project is not a full-stack web application but rather an automation and deployment tool. Its purpose is to assemble a series of scripts (primarily batch files) and instructions into a cohesive system that can create a WinPE flash drive, perform sysprep on a Windows installation, capture a .wim image with DISM, and then deploy (apply) that image using other automated steps.
- Main components include:
- Environment Preparation: Files like “Preparando o ambiente (Server de laboratório)” mentioned in the README for setting up, plus the ADK setup executables (adksetup.exe and adkwinpesetup.exe).
- WinPE Creation: Steps to create a bootable WinPE flash drive (using WinPE commands like copype and MakeWinPEMedia).
- Image Capture Module: The process using sysprep and DISM for capturing the Windows image (.wim).
- Image Deployment Module: Batch files such as LimparDisco.bat, Clonar.bat, and Recuperar.bat that handle disk cleanup, cloning the image, and recovery steps.
- Supporting Tools and Documentation: Text files and links that provide instructions and reference the use of external resources (e.g., Microsoft Docs, YouTube videos).

##### File Structure
- The top-level files are a mix of batch scripts (ApplyImage, Clonar, LimparDisco, etc.) and text documentation. The repository does not follow a nested directory structure; its flat file layout emphasizes scripts and documentation.
- Notice the presence of multiple variants of similar scripts (for example, ApplyImage variants targeting different scenarios or OS environments) that indicate conditional flows depending on hardware/firmware configurations (BIOS vs UEFI).
- Alongside the scripts, there are executables (ADK setup, adkwinpesetup) and a ZIP file (Scripts_DefaultMS.zip) which suggests additional batch resources might be bundled separately.

##### Key Architectural Relationships and Workflow
- ADK and WinPE tools are installed using the provided executables.
- The system prepares the WinPE boot environment on a flash drive.
- Navigation to Sysprep and Image Capture:
- The README instructs to run sysprep on the Windows installation and then boot from WinPE to capture the image using DISM.
- Data flows here from the original Windows system to the captured .wim file stored externally.
- Image Deployment Phase:
- Once the image is captured, several scripts are used in sequence to clean the target disk (LimparDisco.bat), clone the captured image (Clonar.bat), and in case of issues, perform recovery steps (Recuperar.bat).
- Components such as disk partitioning scripts are referenced in text files (e.g., CreatePartitions-BIOS-UEFI variants) indicating that partition layout is an integral part of the process.
- External Dependencies:
- The system relies on running in a WinPE environment, connecting to an external HD for image storage, and using a flash drive as a bootable tool.

##### Final Advice
- The goal is to provide a “big picture” view that makes it clear how a system administrator or engineer would progress through building the WinPE environment through to final image deployment.

## Diagram (Mermaid)

```mermaid
flowchart TD
    subgraph "Environment Setup"
        A1["ADK Setup"]:::env
        A2["WinPE Setup"]:::env
        A3["Documentation"]:::env
    end

    subgraph "WinPE Flash Drive Creation"
        B1["Boot Manager"]:::env
        B2["Default Scripts"]:::env
    end

    subgraph "Boot into WinPE"
        C["Boot into WinPE"]:::env
    end

    subgraph "Image Capture Module"
        D1["Sysprep & DISM"]:::capture
        D2a["Capture Doc"]:::capture
        D2b["Clone Process Doc"]:::capture
    end

    G["Captured Image Storage (.wim)"]:::capture

    subgraph "Image Deployment Module"
        E1["Clean Disk"]:::deploy
        E4["Partition Decision"]:::partition
        E4a["BIOS Partitioning"]:::partition
        E4b["UEFI Partitioning"]:::partition
        E2["Clone Image"]:::deploy
        E3["Apply Image Variants"]:::deploy
        E5["Drive Management"]:::deploy
    end

    subgraph "Recovery and Error Handling"
        F1["Recovery Script"]:::recovery
        F2["Apply Recovery"]:::recovery
    end

    H["Target Device Deployed"]:::deploy

    A3 --> B1
    B1 --> C
    C --> D1
    C --> E1
    D1 --> D2a
    D2a --> D2b
    D2b --> G
    E1 --> E4
    E4 -->|BIOS| E4a
    E4 -->|UEFI| E4b
    E4a --> E2
    E4b --> E2
    E2 --> E3
    G --> E3
    E3 --> E5
    E5 --> H
    E3 -->|"error"| F1
    F1 --> F2
    F2 --> E3

    click A1 "https://github.com/cadubarbosabr/windows10wimclone/blob/main/adksetup.exe"
    click A2 "https://github.com/cadubarbosabr/windows10wimclone/blob/main/adkwinpesetup.exe"
    click A3 "https://github.com/cadubarbosabr/windows10wimclone/blob/main/README.md"
    click B1 "https://github.com/cadubarbosabr/windows10wimclone/blob/main/bootmgr.efi"
    click B2 "https://github.com/cadubarbosabr/windows10wimclone/blob/main/Scripts_DefaultMS.zip"
    click D2a "https://github.com/cadubarbosabr/windows10wimclone/blob/main/Passo a passo.txt"
    click D2b "https://github.com/cadubarbosabr/windows10wimclone/blob/main/Clone Process.txt"
    click E1 "https://github.com/cadubarbosabr/windows10wimclone/blob/main/LimparDisco.bat"
    click E2 "https://github.com/cadubarbosabr/windows10wimclone/blob/main/Clonar.bat"
    click E3 "https://github.com/cadubarbosabr/windows10wimclone/blob/main/ApplyImage.bat"
    click E3 "https://github.com/cadubarbosabr/windows10wimclone/blob/main/ApplyImage1.bat"
    click E3 "https://github.com/cadubarbosabr/windows10wimclone/blob/main/ApplyImageGeneric.bat"
    click E3 "https://github.com/cadubarbosabr/windows10wimclone/blob/main/ApplyImageOnLinux.bat"
    click E4a "https://github.com/cadubarbosabr/windows10wimclone/blob/main/CreatePartitions-BIOS.txt"
    click E4a "https://github.com/cadubarbosabr/windows10wimclone/blob/main/CreatePartitions-BIOS-FFU.txt"
    click E4a "https://github.com/cadubarbosabr/windows10wimclone/blob/main/CreateRecoveryPartitions-BIOS.txt"
    click E4a "https://github.com/cadubarbosabr/windows10wimclone/blob/main/HideRecoveryPartitions-BIOS.txt"
    click E4b "https://github.com/cadubarbosabr/windows10wimclone/blob/main/CreatePartitions-UEFI.txt"
    click E4b "https://github.com/cadubarbosabr/windows10wimclone/blob/main/CreatePartitions-UEFI-FFU.txt"
    click E4b "https://github.com/cadubarbosabr/windows10wimclone/blob/main/CreateRecoveryPartitions-UEFI.txt"
    click E4b "https://github.com/cadubarbosabr/windows10wimclone/blob/main/HideRecoveryPartitions-UEFI.txt"
    click F1 "https://github.com/cadubarbosabr/windows10wimclone/blob/main/Recuperar.bat"
    click F2 "https://github.com/cadubarbosabr/windows10wimclone/blob/main/ApplyRecovery.bat"
    click F2 "https://github.com/cadubarbosabr/windows10wimclone/blob/main/ApplyRecovery.txt"
    click E5 "https://github.com/cadubarbosabr/windows10wimclone/blob/main/ScanearDrives.bat"

    classDef env fill:#ACE7FF,stroke:#000,stroke-width:2px
    classDef capture fill:#BFFECA,stroke:#000,stroke-width:2px
    classDef deploy fill:#FFDD99,stroke:#000,stroke-width:2px
    classDef recovery fill:#FFB3B3,stroke:#000,stroke-width:2px
    classDef partition fill:#D3D3D3,stroke:#000,stroke-width:2px
```
