Commit Graph

533 Commits

Author SHA1 Message Date
rbalsleyMSFT 8d7e4d1066 Refactor config loading and improve error handling
Extracts the logic for importing supplemental assets (Winget, BYO, Drivers) into a new reusable function. This function is now called by both the manual and automatic configuration loaders, reducing code duplication.

Enhances the manual configuration loading process with more robust error handling. It now provides specific user-facing error messages for file read failures, empty files, and invalid JSON, improving the user experience when loading a malformed configuration.

When loading a configuration, if optional supplemental files like AppList.json are referenced but not found, an informational message is now displayed to the user instead of failing silently.
2025-09-15 18:10:39 -07:00
rbalsleyMSFT c30ed923b6 feat: Defer cleanup of compressed driver source folders
Implements a deferred cleanup mechanism for driver source folders when they are compressed to a WIM and also used for WinPE.

When drivers are compressed, the original source folders are now preserved if they are also needed for WinPE driver injection. A marker file is created in these preserved folders.

A new cleanup step is added after the WinPE media creation to remove these preserved folders, ensuring they are available when needed but not left behind permanently.
2025-09-12 15:08:48 -07:00
rbalsleyMSFT 50713188bf Refactor: Improve model name normalization for driver mapping
Enhances the model name normalization function to better handle variations in hardware model strings. This change introduces specific rules to canonicalize "All-in-One" and screen size variants (e.g., "-in" or "inch") for more reliable matching against driver mapping rules.

Additionally, optimizes performance by normalizing the system model once before the comparison loop. Logging is also added to show the original and normalized model strings for easier debugging.
2025-09-11 18:15:51 -07:00
rbalsleyMSFT e2ccd11f07 feat: Add option to dynamically build PE drivers
Introduces a new feature, `UseDriversAsPEDrivers`, that allows WinPE drivers to be sourced directly from the main driver repository.

When enabled, the script scans all available drivers, parses their INF files, and copies only the essential driver types (e.g., storage, mouse, keyboard, touchpad, system devices) needed for WinPE. This eliminates the need to maintain a separate, manually curated `PEDrivers` folder.

The UI is updated with a new checkbox that becomes visible when "Copy PE Drivers" is selected, making this a sub-option. Parameter validation is also adjusted to support this new workflow.
2025-09-11 12:13:06 -07:00
rbalsleyMSFT f3316a017b feat: Add restore defaults and centralize cleanup logic
Introduces a "Restore Defaults" feature in the UI to reset the environment. This action removes generated configuration files, ISOs, downloaded apps, updates, drivers, and FFUs.

The post-build cleanup logic is refactored from the main build script into a new common function. This new function is used by both the standard build process and the new restore defaults feature, promoting code reuse and simplifying maintenance.
2025-09-10 11:31:53 -07:00
rbalsleyMSFT bdf1b63833 Improves UI state after environment autoload
Updates the visibility of UI panels for Winget and drivers when a previous environment is automatically loaded.

This ensures that if Winget apps or driver models are present, their corresponding UI sections are made visible. Additionally, it updates the "select all" checkbox state for Winget results and attempts to pre-select the hardware make for loaded drivers.
2025-09-09 18:00:52 -07:00
rbalsleyMSFT 3ef26f2918 Adds auto-loading of previous configuration on startup
Implements a new feature to automatically load the previously saved environment when the UI is launched.

This improves user experience by restoring the last saved configuration, including selected applications and drivers, eliminating the need to manually reload them on each run.

The process loads the main `FFUConfig.json` and then proceeds to load associated Winget, BYO App, and Driver lists if they are defined. UI elements and checkboxes are updated accordingly to reflect the loaded state.
2025-09-09 17:49:36 -07:00
rbalsleyMSFT 372360d739 Update default disk size to 50GB in FFU scripts and UI
- Changed the default disk size parameter from 30GB to 50GB in BuildFFUVM.ps1 and FFUUI.Core.psm1 to accommodate larger virtual machines.
- Updated tooltip and default value in the UI XAML file to reflect the new disk size.
2025-09-03 12:06:11 -07:00
rbalsleyMSFT dc5877f398 Removes the VM workaround for MCT ESD builds
Comments out the logic that forces app installation when building from a downloaded ESD file. This workaround was implemented to prevent an OOBE reboot loop but is no longer required. This should speed up scenarios where you want to download the ESD media, install the latest CU and .NET CU, and capture the FFU.
2025-08-28 13:56:54 -07:00
jrollmann 556cfa1ee3 Update USBImagingToolCreator.ps1 2025-08-27 17:07:52 -04:00
rbalsleyMSFT 1ab4093d54 Refactor: Enhance artifact cleanup for disabled features
Renames `Remove-DisabledUpdates` to `Remove-DisabledArtifacts` to better reflect its expanded scope.

This function now also removes Office installation scripts and downloaded content if the Office installation is disabled via the `$InstallOffice` flag.

The function call is moved to run before app installations to ensure artifacts are removed prior to the installation phase.
2025-08-27 12:40:11 -07:00
rbalsleyMSFT bf27da5c66 Updates script version to 2508.1Preview
Aligns the version number in the FFU build and deployment scripts with the new preview release.
2025-08-26 17:14:37 -07:00
rbalsleyMSFT 1010b9fce7 Adds cleanup for disabled update artifacts
Introduces a new function to remove residual artifacts for updates that are disabled via script flags.

If updates for Defender, MSRT, OneDrive, or Edge are turned off, this change ensures that any related files are deleted from the build environment. This prevents unnecessary files from being included in the final image.
2025-08-26 17:11:57 -07:00
rbalsleyMSFT 3e34bd6bff Refactor architecture handling for app downloads
Clarifies the distinction between the application architecture to be downloaded and the target Windows architecture for installer pruning.

Renames the `SelectedWindowsArch` parameter to `WindowsArch` and introduces a new `ApplicationArch` parameter. This makes the download and subsequent installer selection logic more explicit and easier to understand, especially for MS Store apps where multiple installers might be available.
2025-08-22 18:47:43 -07:00
rbalsleyMSFT 3f892493c0 Improves Winget installer selection logic
Refines the post-download cleanup process for applications with multiple installers.

When multiple installers are downloaded for an application, this change introduces logic to select the most appropriate one based on the target Windows architecture. It prioritizes universal installers first, then architecture-specific installers, before falling back to the previous method of selecting the newest file by signature date.

This ensures a more accurate installer is chosen, especially when Winget provides multiple architecture options for a single package.
2025-08-22 17:33:09 -07:00
rbalsleyMSFT 7d4567efbe Refactor WinGet app handling and add command overrides
Improves the reliability of WinGet app processing by making several key changes.

The build process now deletes the `WinGetWin32Apps.json` file before each run to ensure it is always freshly generated.

The UI no longer relies on `WinGetWin32Apps.json` to detect previously downloaded content. Instead, it checks directly for the application's content on disk, preventing unnecessary re-downloads.

This change also introduces a feature allowing users to override the default silent install commands for Win32 apps. By specifying `CommandLine` or `Arguments` properties in `AppList.json`, these values will be used to update the corresponding entries in `WinGetWin32Apps.json` during the build process.
2025-08-21 16:46:17 -07:00
rbalsleyMSFT 9aed707a77 Removes redundant optional features textbox
Eliminates the read-only field and derives the features list directly from the checked items, producing a sorted semicolon string when collecting config. Avoids duplicated state, prevents desynchronization between UI elements, and yields deterministic ordering for persistence.
2025-08-19 18:40:09 -07:00
rbalsleyMSFT 0c373e6b2c fix: Fixes an issue with BYO apps that had null arguments. 2025-08-19 17:34:41 -07:00
rbalsleyMSFT a501b32a03 feat: Implement per-user Appx package detection and removal for Sysprep automation
- Added logic to check for per-user Appx packages that are not provisioned for all users, which could block the Sysprep process.
- Introduced a hash set to store provisioned package families and collect current user Appx packages while excluding frameworks and non-removable packages.
- Implemented removal of non-provisioned Appx packages with error handling and re-checking to ensure all blockers are resolved before proceeding with Sysprep.
2025-08-18 15:54:11 -07:00
rbalsleyMSFT 8ab6603999 feat: Add new checkbox to Inject Unattend.xml to VM.
- Creates a new parameter [bool]InjectUnattend

- This will take the FFUDevelopment\Unattend\unattend_[arch].xml file and copy it to the FFUDevelopment\Apps\Unattend and rename the file to unattend.xml.

- This is useful for situations where you don't use the USB drive for deploying the FFU but still have Unattend-related customizations that you want to apply.
2025-08-14 16:20:55 -07:00
rbalsleyMSFT 85383f989a fix: - Improved handling of special characters with driver model names when doing automatic driver/model matching when applying the FFU to a device.
- Added some console output when drivers are being installed from a folder
2025-08-13 18:48:28 -07:00
rbalsleyMSFT 0423ac31d9 feat: Enhance installer selection logic in Add-Win32SilentInstallCommand function
- Improved detection of installer candidates by reading YAML configuration for NestedInstallerFiles.
- Added logic to resolve silent install switches from YAML, prioritizing block-level settings.
- Enhanced fallback mechanisms for selecting installers when multiple candidates are found.
- Updated command construction to accommodate new installer resolution logic.
2025-08-13 16:48:18 -07:00
rbalsleyMSFT 35f37f3a36 fix: Microsoft Update Catalog now includes the windows version information in the KB article title. This caused an issue where parsing the KB article was failing. Fixed the regex to accomdate this. 2025-08-12 17:30:28 -07:00
rbalsleyMSFT 78d7bb9262 feat: Add VM switch selection logic and persist custom names/IPs in UI
- Implemented Select-VMSwitchFromConfig function to handle VM switch selection based on configuration.
- Enhanced Register-EventHandlers to persist custom VM switch name and IP address when 'Other' is selected.
- Improved user experience by ensuring relevant fields are populated correctly based on user input and configuration settings.
2025-08-12 12:14:03 -07:00
rbalsleyMSFT 3c545be5c5 Hardens driver downloads and cleanup
Adds in‑progress markers around OEM driver downloads to enable recovery and reliable post‑run cleanup.

Refactors driver cleanup to be run‑aware: maps download targets to model folders, removes temp/model content created during the run, prunes empties, and preserves existing make roots via creation‑time checks.

Includes the Drivers folder in current‑run cleanup with safer rules to avoid deleting pre‑existing content.

Improves Office process termination by resolving the Office path (prefers UI value) and only acting when a valid folder exists.
2025-08-11 19:36:58 -07:00
rbalsleyMSFT c1983f75e6 fix: fixed unattend file copying logic for USB deployment based on architecture 2025-08-08 19:29:50 -07:00
rbalsleyMSFT 7c3de6d77f feat: Add cleanup functionality and improve build cancellation process in UI
- Introduced flags to track if a build is in progress and if cleanup is running.
- Enhanced the button click handler to allow users to cancel an ongoing build and initiate a cleanup process.
- Implemented a mechanism to stop background jobs and terminate associated processes during cancellation.
- Added logic to manage log file reading during cleanup and ensure proper UI updates.
- Updated the state management to reflect the current operation status accurately.
2025-08-08 18:22:40 -07:00
rbalsleyMSFT 17dc80f11b fix: Fix computer name being echoed during device naming 2025-08-07 18:08:25 -07:00
rbalsleyMSFT 846d449aac feat: Add MaxUSBDrives parameter for parallel USB drive processing
- Introduced a new parameter `MaxUSBDrives` to control the maximum number of USB drives that can be built in parallel, with a default value of 5.
- Updated UI to include a textbox for setting `MaxUSBDrives`.
- Implemented validation to ensure the value is a non-negative integer.
- Adjusted the deployment function to respect the `MaxUSBDrives` limit during USB drive creation.
2025-08-07 16:32:25 -07:00
rbalsleyMSFT db9b7335f2 refactor: Inject unattend file after VHDX caching for audit-mode boot
- Moved unattend file injection logic to occur after VHDX caching to ensure the cached VHDX does not contain audit-mode unattend.
- Simplified the logic to determine if the VHDX is already mounted, reducing redundant mount/dismount cycles.
- Ensured the unattend file is copied to the correct directory based on the Windows architecture.
2025-08-07 13:58:09 -07:00
rbalsleyMSFT 6f98473009 Refines driver mapping logic and adds diagnostic logging
Improves JSON parsing of the driver mapping file to handle different file structures more reliably.

Adds logging to show all potential driver mapping rules that match the current system, making it easier to diagnose rule selection.
2025-08-06 17:46:13 -07:00
rbalsleyMSFT 357261ec73 Fix: Clarify computer name is set on reboot
Updates the logging messages to more accurately reflect that the computer name change takes effect after a restart. The `Set-Computername` command stages the change, so the log now indicates the name "will be set" instead of "was set".
2025-08-06 17:01:04 -07:00
rbalsleyMSFT 5bef901295 Deduplicate device name section header output
Moves the 'Device Name Selection' section header out of the conditional blocks to a common location. This refactoring avoids code repetition and improves maintainability.
2025-08-06 16:42:54 -07:00
rbalsleyMSFT 59e247c012 Fixes LocalAccounts module issue in PowerShell 7
Applies a workaround for an issue where the `Microsoft.PowerShell.LocalAccounts` module fails to load in PowerShell 7 on Windows 11 23H2 and earlier.

The script now checks the OS build number and imports the module using the Windows PowerShell compatibility layer on affected systems.

Fixes: https://github.com/PowerShell/PowerShell/issues/21645
2025-08-06 15:56:21 -07:00
rbalsleyMSFT a87c4796b5 feat: Implement multi-select and editing for BYO apps
Introduces multi-selection capabilities to the "Bring Your Own" applications list, allowing users to select and remove multiple applications at once.

This change also adds the ability to edit an existing application's details directly from the UI. The application list view is now dynamically generated to support these new features, including selectable rows.

Key changes:
- Adds "Edit Application" and "Remove Selected" buttons.
- Enables/disables action buttons based on the number of selected items.
- Modifies the "Add Application" form to function as an "Update" form when editing.
- Implements selection via mouse click, checkboxes, and the spacebar.
2025-08-05 19:07:41 -07:00
rbalsleyMSFT 4d289ee14a Add detailed flowchart for BuildFFUVM process in Markdown format 2025-08-05 14:51:01 -07:00
rbalsleyMSFT 08feb7c9dd Removes drivers.json file requirement for local drivers 2025-08-04 18:34:26 -07:00
rbalsleyMSFT 9cb06cb71e Updates the UI logic to automatically enable the 'Install Apps' option when 'Install Winget Apps' or 'Define Apps Script Variables' is selected.
This ensures the main application installation feature remains active when any of its dependent options are chosen, creating a more consistent user experience.
2025-08-04 17:50:12 -07:00
rbalsleyMSFT 5ec607d94a Enforce 'Install Apps' selection for BYO apps
Updates UI logic to automatically select the main 'Install Apps' option whenever the 'Bring Your Own Apps' option is selected.

This ensures the parent category is always active when a user opts to bring their own applications, preventing an inconsistent UI state. The logic is applied both when updating panel visibility and when restoring checkbox states.
2025-08-04 17:39:17 -07:00
rbalsleyMSFT ac7ef119e0 Feat: Add option to ignore non-zero application exit codes
Introduces a new feature allowing application installations to succeed regardless of their exit code. This is useful for installers that may return non-standard exit codes which should be treated as successful.

Changes include:
- A new checkbox in the UI to enable this option for an application.
- Updates to the application installation script to handle the new setting.
- Modifications to save and load this setting in the application list.
2025-08-04 17:21:34 -07:00
rbalsleyMSFT 03c8127bd3 Feat: Add support for custom success exit codes
Refactors the process invocation logic to use the .NET Process class for more robust output stream handling and to avoid temporary files.

Introduces a feature allowing users to specify additional success exit codes for applications in the UI. These codes are now considered successful during the installation process.

Adds a 'PAUSE' command to halt script execution and wait for user input.
2025-08-04 13:17:52 -07:00
rbalsleyMSFT eb001e59b3 Refine build cleanup and script variable handling
Updates the build process to remove any existing Apps.iso during cleanup, ensuring a fresh build without stale artifacts.

Clarifies in the app script template that configuration variables are treated as strings. The examples are updated to reflect this, preventing potential errors in custom scripts when checking for boolean-like values.
2025-08-01 19:42:04 -07:00
rbalsleyMSFT 3e46d4b280 Bumps script version to 2507.2
Updates the version number in the build and deployment scripts.
2025-08-01 14:44:12 -07:00
rbalsleyMSFT eae07fcad0 Improves ADK FWLink resolution for robustness
Refactors the ADK URL retrieval logic to let `Invoke-WebRequest` handle the forward link redirection directly. This approach is more reliable than manually parsing the redirect response.

Adds a try/catch block to provide better error handling and logging during the URL resolution process.
2025-08-01 12:36:45 -07:00
rbalsleyMSFT 2147746ff9 Remove sample inbox app list
Deletes the sample JSON file containing a list of inbox applications as it is no longer required.
2025-07-30 16:39:05 -07:00
rbalsleyMSFT 3a909c76e0 Implements dynamic retrieval of Lenovo PSREF API token
Adds a new function to programmatically retrieve the required authentication token for the Lenovo PSREF API. This change is necessary as Lenovo is now restricting API access without a JavaScript-generated token.

The new function launches a headless browser instance, uses the DevTools protocol to extract the token from local storage, and then terminates the browser. This ensures continued access to the comprehensive model data available through the PSREF API, which is not fully present in other catalogs.

The User-Agent string has also been updated.
2025-07-30 11:47:05 -07:00
rbalsleyMSFT 30c7f6f705 Refactor Win32 app installation to process sources separately
Updates the Win32 app installation script to handle WinGet-sourced apps and user-defined apps in two separate batches instead of merging them. This ensures all WinGet apps are installed before any user-defined apps.

The core installation logic is extracted into a reusable function, improving script structure and readability.

Additionally, removes a pause command and a redundant console message from other scripts to improve automation flow.
2025-07-25 18:35:19 -07:00
rbalsleyMSFT b4f1985c99 Refactor dependency resolution to be app-specific
Change the dependency resolution logic from a single global scan to an isolated, per-application scan.

This prevents potential version conflicts that could occur if multiple applications require different versions of the same dependency package. Each application now resolves its dependencies only from its own dedicated 'Dependencies' folder, ensuring the correct versions are used and making the installation process more robust and reliable.
2025-07-25 17:33:16 -07:00
rbalsleyMSFT c57e7ebdfe Improve architecture handling for msstore applications
Refactors the application download logic to correctly handle packages from the 'msstore' source, which does not support architecture specification.

- The download process no longer passes an architecture parameter for msstore apps.
- The architecture selection dropdown in the UI is now disabled for msstore apps to prevent invalid configurations.
- Imported or searched msstore apps will display 'NA' for their architecture.
2025-07-25 15:29:25 -07:00
rbalsleyMSFT fc79251f66 Overhauls Store app installation with dependency resolution
Refactors the Store app installation script to be significantly more robust and intelligent. The new implementation automatically resolves application dependencies instead of relying on a simple folder structure.

Key improvements include:
- Pre-scans all application folders to create a central catalog of available dependencies.
- Parses the `AppxManifest.xml` from each main app package (including from within bundles) to determine its true dependencies.
- Resolves the required dependencies by finding the best available package from the catalog that meets version and OS architecture requirements.
- Adds support for extracting zipped dependency packages.
- Improves temporary file management and logging.
2025-07-25 14:31:03 -07:00