Commit Graph

709 Commits

Author SHA1 Message Date
rbalsleyMSFT 7043af47c3 Feat: Add live log monitoring tab to UI
Introduces a new "Monitor" tab in the `BuildFFUVM` UI to display live log output from the build process.

When a build is started, the UI now automatically switches to the Monitor tab. It tails the main log file in real-time and displays the content in a list view, which auto-scrolls as new entries appear.

This provides immediate visual feedback on the build progress and any errors without needing to manually open the log file.

Additionally, this change adds a Ctrl+C keyboard shortcut to copy selected log lines from the monitor view to the clipboard.
2025-07-10 19:56:59 -07:00
rbalsleyMSFT ebbb3e8ed0 Run build process in background job to keep UI responsive
Refactors the FFU build process to execute asynchronously using a background job. This prevents the UI from freezing during the build.

A timer now polls the job status and updates the UI with the final result (success or failure) upon completion. The build button is also disabled while a build is in progress to prevent multiple executions.
2025-07-10 18:00:03 -07:00
rbalsleyMSFT 863f0bba2c Refactor error handling and improve diagnostics
Introduces a centralized function to handle script termination, ensuring the DISM log is always copied on failure for easier debugging.

Improves user-facing error messages to provide clearer guidance for common issues, such as a missing hard drive, incorrect USB drive configuration, or FFU logical sector size mismatches.

Adds post-deployment verification to ensure the Windows partition is created and assigned a drive letter correctly after applying the FFU.
2025-07-10 16:09:15 -07:00
rbalsleyMSFT 7df81177de Enhance console output for readability and user experience
Refactors the script's console output to be cleaner and more user-friendly.

- Adds formatted section headers to clearly delineate each stage of the deployment process.
- Replaces verbose console logging with more selective and meaningful status messages for the user.
- Prevents external commands from opening new windows, creating a more seamless execution flow in the terminal.
2025-07-10 14:32:57 -07:00
rbalsleyMSFT 9f6ea0fb58 Improve driver injection by mounting WIMs
Replaces the slow WIM extraction process with a faster WIM mount operation. This significantly improves performance when injecting drivers from a WIM file.

The script now properly unmounts the WIM after injection to ensure resources are cleaned up correctly.

Additionally, log messages are now written to the console for better real-time feedback during script execution.
2025-07-10 12:24:49 -07:00
rbalsleyMSFT f64514cbe6 Enhance script output and information gathering
Adds a new function to gather and display detailed system information (model, CPU, memory, disk size) in both the log file and the console. This helps with verification and troubleshooting.

Improves the user experience by adding an ASCII art banner and cleaning up the console output by suppressing progress bars and command echoes.

Modernizes the script by replacing the deprecated `Get-WmiObject` cmdlet with `Get-CimInstance`.
2025-07-09 18:53:50 -07:00
rbalsleyMSFT b651bc6385 Fixes FFU selection table output
Pipes the FFU selection table through `Out-String` to ensure it is correctly rendered in the console. This prevents potential issues where the formatted table object is not displayed as intended.
2025-07-09 15:32:01 -07:00
rbalsleyMSFT 6b7351d1b3 Hides download settings when using a local ISO
Updates the UI to conditionally hide the Windows language and media type controls. These settings are only applicable when downloading a new image and are irrelevant when a local ISO file is provided.

This change simplifies the user interface and prevents confusion by only showing options relevant to the selected action.
2025-07-09 14:49:42 -07:00
rbalsleyMSFT 878b93889f Refactors ISO path handling for clarity and robustness
Inverts the conditional logic for determining available Windows releases and versions based on whether an ISO path is provided.

This change improves code readability by checking for the positive case (an ISO is present) first. It also adds validation to ensure the file path ends with the `.iso` extension.
2025-07-09 13:26:09 -07:00
rbalsleyMSFT 9edbcc6f01 feat: Dynamically update Windows architecture options
Implements logic to filter the available Windows architectures based on the selected OS Release, Version, and SKU. This ensures that only valid architecture options are presented to the user.

- Adds a new function to determine the correct architectures for different Windows versions (e.g., Server, Windows 10/11, LTSC editions).
- Wires up event handlers to the Release, Version, and SKU dropdowns to refresh the architecture list when their selection changes.
- Refactors initialization to use this new dynamic logic.
2025-07-09 12:56:57 -07:00
rbalsleyMSFT 3f6661e2dc Corrects display name for 2024 LTSC release
Updates the display name for the 2024 LTSC release to correctly identify it as Windows 11 instead of Windows 10.
2025-07-09 11:38:54 -07:00
rbalsleyMSFT f9a8e3149f Adds a "Verbose" checkbox to the UI, allowing users to enable write-verbose output from the underlying build script.
This helps in troubleshooting the FFU build process by providing more detailed output to the console. The verbose setting is saved to and loaded from the configuration file.
2025-07-09 09:50:26 -07:00
rbalsleyMSFT 4ef7c2fb0b Propagates verbose preference to the common module
Sets the verbose preference within the `FFU.Common` module to match the preference of the calling script.

This ensures that when the script is run with the `-Verbose` switch, verbose output from the module is also logged to the console.
2025-07-08 18:51:19 -07:00
rbalsleyMSFT d6689888b2 Refactor: Remove redundant Success property assignment
Removes the logic that adds a `Success` property to the returned object when an existing driver package is found.

This property is handled by the calling function, making this assignment unnecessary and simplifying the driver-saving task functions.
2025-06-28 00:57:38 -07:00
rbalsleyMSFT 1523091637 Feat: Add WIM compression for existing driver folders
Implements logic to compress previously downloaded driver folders into WIM files if the compression option is enabled. This ensures consistency in the driver store when re-running the download process.

Refactors the parallel task processing to rely on a standardized boolean 'Success' property from all driver download tasks. This simplifies the result handling logic and makes it more reliable than parsing status strings.
2025-06-28 00:51:22 -07:00
rbalsleyMSFT 0b0046986e Refactor driver existence check into a common function
Adds a new `Test-ExistingDriver` function to the common driver module to centralize the logic for checking if drivers have already been downloaded, either as a folder or a WIM file.

This change removes duplicated code from the Dell, HP, Lenovo, and Microsoft driver download tasks, simplifying maintenance and ensuring consistent behavior across all manufacturers.
2025-06-27 21:14:53 -07:00
rbalsleyMSFT 1b0c0da677 Optimize driver download by checking for existing WIM files
Refactors the driver download logic for all manufacturers to first check for the existence of a final `.wim` archive. If a WIM file is found, the download and processing for that model is skipped, significantly improving performance on subsequent runs.

This change also resolves a potential type conversion error when processing driver mapping JSON files and corrects a minor typo in a log message.
2025-06-27 12:51:51 -07:00
rbalsleyMSFT 660a619944 Improves driver matching to select the most specific rule
Refines the driver selection logic to correctly handle overlapping or wildcard-based rules in the driver mapping file.

Previously, the script would use the first rule that matched the system manufacturer and model. This could lead to a less specific rule being chosen if it appeared before a more specific one.

The logic now finds all matching rules and selects the one with the most specific model name, ensuring a more accurate driver package is applied.
2025-06-27 10:57:33 -07:00
rbalsleyMSFT dcb7957d15 Refactor driver handling and remove preview update option
Removes the parameter for installing preview cumulative updates to simplify the script's interface.

Improves logging during the driver copy process to provide better visibility into which drivers are being used.

The UI no longer loads the selected device 'Make' from the configuration on startup.
2025-06-27 09:34:25 -07:00
rbalsleyMSFT dfe07b16ae Adds support for an initial directory in folder picker
Enhances the modern folder browser to accept and open to a specified initial directory.

This improves the user experience by starting the "Browse for Drivers" dialog in the project's 'Drivers' subfolder, reducing the need for manual navigation. The implementation uses the Win32 API to create a shell item from the initial path and set it as the dialog's starting folder.
2025-06-26 18:37:22 -07:00
rbalsleyMSFT 9bbb40ce8c feat: Clean up driver source and obsolete config
Automatically deletes the source driver folder after successful compression into a WIM file to conserve disk space. A failure to delete will only log a warning and not interrupt the process.

Removes unused 'Make' and 'Model' properties from the UI configuration.
2025-06-26 18:12:35 -07:00
rbalsleyMSFT 98c5946efd Feat: Automate driver selection during FFU deployment
Adds a `DriverMapping.json` file to automate driver injection during image deployment.

Driver download tasks now generate or update this mapping file with the relative path for each successfully downloaded driver package.

The deployment script now uses this file to automatically detect and select the correct drivers for the target hardware, removing the need for manual selection. The manual driver selection prompt is retained as a fallback.
2025-06-26 17:45:31 -07:00
rbalsleyMSFT 40fd739b2c Refactor: Unify driver WIM and folder detection
Streamlines the driver discovery process by searching for both WIM files and driver folders at the same time. This replaces the previous sequential logic that checked for WIMs first, then folders.

If multiple driver sources are found, they are now presented in a single, unified list for user selection, regardless of whether they are a WIM or a folder. This simplifies the script's control flow and improves the user experience.
2025-06-24 17:01:15 -07:00
rbalsleyMSFT d2909ab21d Adds support for driver installation from WIM files
Updates the driver installation logic to prioritize searching for and installing drivers from .wim files located in the `Drivers` directory. If a single WIM is found, it is used automatically. If multiple WIMs are found, the user is prompted for a selection.

The script extracts the WIM to a temporary location before injecting the drivers. The previous method of installing from a folder is retained as a fallback if no WIM files are present. Error handling and cleanup for the WIM installation process are also included.
2025-06-24 16:13:02 -07:00
rbalsleyMSFT 4f5445a833 Refactor MSI extraction for improved reliability
Implements a dedicated mutex to serialize MSI extraction operations. This prevents race conditions when multiple driver packages are processed in parallel by different tasks.

Adds a post-extraction verification step to ensure the target directory is not empty. This guards against silent failures where `msiexec` exits successfully but extracts no files, triggering a retry if necessary.
2025-06-24 13:01:23 -07:00
rbalsleyMSFT 54dad486a4 Corrects list view updates to use ItemsSource
Modifies the item lookup logic to query the `ItemsSource` property instead of the `Items` collection.

This ensures changes are applied directly to the underlying data source, leading to more reliable UI updates.
2025-06-23 13:44:56 -07:00
rbalsleyMSFT 84fca7ba25 Fixes download logic for filtered driver lists
Updates the download function to source selected drivers from the complete data model instead of the UI's filtered view.

This corrects an issue where selected drivers would be excluded from the download operation if they were hidden by a filter.
2025-06-20 18:00:44 -07:00
rbalsleyMSFT 795b4e5095 Optimize Dell catalog parsing to reduce memory usage
Refactors the Dell driver catalog parsing to use a streaming `System.Xml.XmlReader` instead of loading the entire XML file into memory.

This change significantly reduces the memory footprint and improves performance, especially when processing large catalog files. The new approach reads the file node by node, processing each software component individually.
2025-06-20 17:46:02 -07:00
rbalsleyMSFT 2e497ccec8 Refactor: Pre-process Dell catalog before parallel downloads
Moves the Dell catalog download and preparation logic from the individual driver download task to the parent function.

This prevents a race condition where multiple parallel tasks would attempt to download and extract the same catalog file simultaneously. The catalog is now prepared once before any driver downloads begin, improving efficiency and reliability.

Additionally, comments out manual garbage collection calls in the VM build UI.
2025-06-20 16:30:23 -07:00
rbalsleyMSFT d0c5ddc9c7 Refactor UI config logic into a core module
Moves the logic for saving and loading configuration files from the main UI script into the `FFUUI.Core.Config` module. This change improves modularity and separation of concerns, making the code easier to maintain.

The main `BuildFFUVM_UI.ps1` script is simplified, with event handlers now calling the new, dedicated functions in the core module to manage configuration state.

Also corrects the path for the `FFUConfig.json` file.
2025-06-20 14:25:39 -07:00
rbalsleyMSFT 9871d1c23b Refactors driver download logic into a dedicated function
Extracts the driver download implementation from the button click event handler into a new `Invoke-DownloadSelectedDrivers` function.

This change improves code modularity and maintainability by separating the business logic for downloading drivers from the UI event handling code. The event handler is now simplified to a single function call.
2025-06-20 12:09:39 -07:00
rbalsleyMSFT 50eec23c85 Refactor Get Models logic into a dedicated function
Extracts the model fetching and UI update logic from the button's click event handler into a new, reusable `Invoke-GetModels` function.

This refactoring improves code organization by separating UI event handling from the core application logic, leading to better readability and maintainability.
2025-06-20 12:01:02 -07:00
rbalsleyMSFT 1675c48fc3 Refactor and improve ListView item selection
Extracts the logic for toggling an item's selection state with the spacebar into a new, reusable function. This change centralizes previously duplicated code, improving maintainability.

The event handling is moved from `KeyDown` to `PreviewKeyDown` to provide a more reliable user experience. Additionally, focus is now correctly restored to the toggled item, preventing the selection from moving unexpectedly.
2025-06-20 11:50:47 -07:00
rbalsleyMSFT 86ec6de894 Refactor: Centralize file and folder dialog logic
Introduces a new `Invoke-BrowseAction` helper function to consolidate the creation of file and folder selection dialogs.

This change replaces scattered and repetitive `OpenFileDialog`, `SaveFileDialog`, and `ModernFolderPicker` implementations throughout the event handlers with a single, unified function call. This refactoring simplifies the event handler code, reduces duplication, and improves maintainability.
2025-06-20 11:13:58 -07:00
rbalsleyMSFT ca0a51ec15 Refactor VM Switch initialization logic
Move the `Initialize-VMSwitchData` function call from the main UI script into the `Initialize-UIDefaults` function.

This change centralizes the UI default initialization logic within the core module, improving code organization and ensuring VM Switch data is loaded at the correct time.
2025-06-19 19:16:11 -07:00
rbalsleyMSFT 244aba88d3 Refactor UI initialization into core module
Moves UI initialization logic for the "Bring Your Own" applications section from the main UI script into the `FFUUI.Core` module.

This centralization cleans up the main script's `Loaded` event handler and improves code organization and maintainability.
2025-06-19 19:06:56 -07:00
rbalsleyMSFT 4b7e815c68 Refactor Applications tab UI event handling
Consolidates the scattered event handlers for the Applications tab checkboxes into a single, centralized function and a shared event handler. This new approach manages the visibility of all dependent UI panels based on the state of the checkboxes.

This refactoring simplifies the codebase, eliminates redundant logic, and ensures a more consistent and predictable user interface state.

Additionally, this change fixes bugs where clearing list views for Winget results and drivers did not properly update their "select all" header checkboxes.
2025-06-19 18:38:53 -07:00
rbalsleyMSFT c946e56a41 Refactors CU checkbox initialization logic
Moves the initial state logic for the "Latest CU" and "Preview CU" checkboxes from the main UI script to the core initialization module.

This change centralizes UI default settings into the `Initialize-UIDefaults` function, improving code organization and maintainability.
2025-06-19 18:12:06 -07:00
rbalsleyMSFT cbc9ec4634 Refactor: Remove Office UI logic from load event
Removes the logic for managing the visibility of Office installation options from the window's loaded event handler.

This change centralizes UI state management within dedicated event handlers, simplifying the initial UI setup.
2025-06-19 16:40:13 -07:00
rbalsleyMSFT 094e084316 Refactor and centralize UI panel visibility logic
Consolidates the logic for showing and hiding UI elements into dedicated functions, `Update-DriverDownloadPanelVisibility` and `Update-OfficePanelVisibility`.

This change simplifies the event handlers for the "Download Drivers" checkbox by using a single handler for both checked and unchecked states. It also moves the initial UI setup from the main script into the core initialization module, improving code organization and reducing duplication.
2025-06-19 16:37:32 -07:00
rbalsleyMSFT 52085cf521 Refactor Apps Script Variables UI logic
Extracts inline event handler logic for managing Apps Script Variables from the main UI script into new functions within the `FFUUI.Core.Applications` module.

This change improves code organization and maintainability by centralizing the logic for adding and removing variables. The event handlers are updated to call these new, dedicated functions.
2025-06-19 16:11:40 -07:00
rbalsleyMSFT a4e9b70b27 Refactor: Centralize driver checkbox event handling
Moves the interdependent state logic for the driver-related checkboxes from the main UI script into a new, centralized function within the core module.

This change simplifies the event handling by using a single handler for all related checkboxes, which improves code readability and maintainability. The new function is also called during initialization to ensure the UI reflects the correct state on startup.
2025-06-19 15:42:57 -07:00
rbalsleyMSFT 2cfd947429 Refactor UI event handlers into core module
Moves the 'Browse' button click event handlers from the main UI script into the core handlers module.

This change improves code organization and separation of concerns. The handlers are updated to be more self-contained by retrieving state from the event source rather than relying on a global state variable, which improves modularity.
2025-06-19 15:31:00 -07:00
rbalsleyMSFT 24ed20305f Refactor: Decouple BYO Apps UI logic into core modules
Moves the event handling and business logic for the "Bring Your Own Applications" feature from the main UI script into dedicated core modules.

This change improves code organization and separation of concerns by centralizing application-related functions and their corresponding event handlers. The main UI script is now cleaner and primarily responsible for UI initialization, enhancing overall code maintainability.
2025-06-19 15:19:35 -07:00
rbalsleyMSFT 12607cca44 Refactor: Move Winget download logic to core module
Extracts the Winget app download logic from the main UI script into a new `Invoke-WingetDownload` function within the core Winget module.

This change decouples the UI event handling from the business logic, improving modularity and maintainability. It also introduces more robust error handling for the download process by wrapping the logic in a try/catch block.
2025-06-19 12:23:13 -07:00
rbalsleyMSFT 00ee79d33c Style: Remove extraneous blank lines
Improves code readability by removing unnecessary whitespace.
2025-06-19 12:16:55 -07:00
rbalsleyMSFT d7d0cb3a06 Refactor: Centralize UI event handlers and abstract list clearing
Moves UI event handling logic from the main script into a dedicated core module to improve separation of concerns.

Introduces a new shared function, `Clear-ListViewContent`, to consolidate duplicated logic for clearing list views. This generic function handles user confirmation, data source clearing, and UI updates for multiple tabs, significantly reducing code redundancy.
2025-06-19 12:11:57 -07:00
rbalsleyMSFT ec8ce1f2f6 Refactor: Move application tab event handlers to core module
Relocates the event handling logic for the "Applications" tab from the main UI script into the `FFUUI.Core.Handlers` module.

This improves code organization and modularity by centralizing UI logic. The handlers are also updated to use local state instead of a global variable.
2025-06-19 11:00:14 -07:00
rbalsleyMSFT f7f78da1a1 Chore: Remove unnecessary comment
Removes a redundant comment from the UI script to improve code readability.
2025-06-18 17:31:47 -07:00
rbalsleyMSFT 49b0772076 Refactor USB drive UI logic into core modules
Moves event handlers and initial state configuration for the USB drive creation settings from the main UI script into the core handler and initialization modules.

This change centralizes the UI logic, improving code organization and maintainability.
2025-06-18 17:30:23 -07:00