Commit Graph

543 Commits

Author SHA1 Message Date
rbalsleyMSFT 57cb349371 Improve driver injection logic and user feedback
Enhances the driver mapping logic to ensure JSON files with a single entry are handled correctly. The model matching is now more flexible, allowing for partial matches in either direction between the system's reported model and the mapping file.

Adds a user-facing message to indicate that the driver injection process may take a significant amount of time, preventing confusion about the script stalling.
2025-07-23 20:42:30 -07:00
rbalsleyMSFT 791040364b Improves error reporting for failed FFU builds
Refactors the error handling for failed build jobs to more reliably capture the root cause of the failure.

The logic now uses `Receive-Job` with an `ErrorVariable` to directly capture the error stream from the job, which provides a more accurate terminating error message than the previous method.

Additionally, the error message box now includes the full path to the log file, making it easier for the user to locate.
2025-07-23 19:37:51 -07:00
rbalsleyMSFT defd744ef0 Refactor winget download logic and error handling
Improves the reliability and clarity of the application download process.

- Introduces specific error codes for download failures, such as publisher restrictions from the Microsoft Store.
- Blocks downloading the Company Portal app from the `winget` source due to packaging issues and provides a user-friendly message.
- Refines status messages in the UI for better user feedback.
- Installs the WinGet PowerShell module for all users to prevent context-related issues.
2025-07-23 17:28:12 -07:00
rbalsleyMSFT 298809686b Add zip extraction and improve UWP app detection
Enhances the application download logic to automatically extract zip archives. This allows for handling packages that are delivered in a compressed format.

Improves the reliability of identifying UWP applications by iterating through all downloaded files instead of checking only the first one. This prevents errors when multiple files are present after download or extraction.
2025-07-22 16:00:11 -07:00
rbalsleyMSFT 1b80d008ef Stops running build job when UI is closed
Adds cleanup logic to the window's `Closed` event handler to properly terminate any active background build job.

This prevents the build process from becoming an orphaned job if the user closes the UI while a build is in progress. The change ensures the job, its polling timer, and log streams are all stopped and disposed of correctly.
2025-07-22 13:54:41 -07:00
rbalsleyMSFT 0e53e43c77 Improves Win32 app detection and logging
Refines the logic for verifying existing Win32 applications by checking for architecture-specific names (x86, x64, arm64).

Enhances validation by ensuring the application folder contains files of a sufficient size, not just that the folder exists.

Adds more detailed logging to aid in troubleshooting cases where an app is not found or its content is missing.
2025-07-21 19:12:10 -07:00
rbalsleyMSFT bb76d2edcf Refactor WinGet app existence check for multi-arch support
Improves the pre-download check to correctly identify existing multi-architecture applications by looking for both x86 and x64 subfolders.

This prevents unnecessary re-downloads of apps that have separate builds for each architecture. The logic is also consolidated to remove a redundant code block.
2025-07-21 17:48:59 -07:00
rbalsleyMSFT c9499d839c Improve performance of update comparison in cache lookup
Replaces the `Compare-Object` cmdlet with a faster, manual loop comparison on pre-sorted arrays to optimize the VHDX cache check for matching updates.

This change also refactors the extraction of update filenames for better readability and adds checks for empty collections to improve script robustness.
2025-07-21 16:13:14 -07:00
rbalsleyMSFT ba1dd3df6b Refactor: Simplify update package file lookup
Streamlines the logic for finding Cumulative Update (CU) and Cumulative Update Preview (CUP) files by removing redundant code.

The file search now relies directly on a wildcard search using the KB article ID, instead of first attempting a match with a specific filename. This change simplifies the script and makes the discovery process more direct. Also removes commented-out code.
2025-07-21 11:24:44 -07:00
rbalsleyMSFT 721f93d82d feat: Add per-app architecture selection and multi-arch downloads
Introduces the ability to specify and download multiple architectures for a single application.

- Adds an "Architecture" dropdown column to the Winget UI, allowing users to select the desired architecture(s) for each app (e.g., x86, x64, arm64, or 'x86 x64').
- Updates the download logic to process each specified architecture, creating separate subfolders for multi-architecture Win32 apps.
- Modifies the app list format to save and load the selected architecture for each application.
- Improves the download process by checking if an application has already been downloaded before attempting a new download.
2025-07-18 20:12:05 -07:00
rbalsleyMSFT 9df663dc9b Refactor to eliminate global variable dependencies
Removes the use of global variables for paths and architecture settings. Instead, these values are now passed explicitly as parameters to the relevant functions.

This change improves code clarity, reduces the risk of side effects, and makes the functions more modular and easier to test.
2025-07-18 17:25:39 -07:00
rbalsleyMSFT c535126605 Docs: Announce 2507.1 preview release
Updates the README to announce the new preview release, which features a major user interface update.

Removes an obsolete development zip archive.
2025-07-18 15:29:55 -07:00
rbalsleyMSFT 6df7b16cdf Docs: Add PowerShell comment-based help to all script modules
Adds standard PowerShell comment-based help blocks (synopsis and description) to all UI and common library script modules (`.psm1`) and the main UI entry point script (`.ps1`).

This improves maintainability and discoverability by documenting the purpose of each script file. Also removes various redundant or commented-out code blocks.
2025-07-18 14:52:03 -07:00
rbalsleyMSFT 7cc7919da4 Feat: Add configurable thread limit for parallel operations
Adds a "Threads" setting to the UI, allowing users to control the throttle limit for parallel tasks like driver and application processing.

This introduces a new textbox in the build options and updates the parallel processing function to use this configurable value instead of a hardcoded one.

Input validation is also added to ensure the threads value is a valid integer and is at least 1. The new setting is integrated into the configuration save/load functionality.
2025-07-18 13:45:58 -07:00
rbalsleyMSFT e639cee4ee Prevents adding duplicate application names
Adds a validation check to ensure application names are unique.

If a user attempts to add an application with a name that already exists, a warning message is displayed, and the operation is cancelled.
2025-07-17 18:28:09 -07:00
rbalsleyMSFT da299d8a03 Fix race condition in parallel UI status updates
Prevents stale, intermediate status messages from overwriting the final status of a completed task in the UI.

A set of completed task identifiers is now maintained. Any incoming intermediate status updates for tasks that are already marked as complete are ignored.

The job completion logic is also refactored for better robustness and clarity across different job-end states (failed, completed with data, completed without data).
2025-07-17 18:24:44 -07:00
rbalsleyMSFT b04a8460b0 Refactor BYO app copy and add overwrite confirmation
Improves the "Copy BYO Apps" functionality by centralizing the `UserAppList.json` update process. The application list is now saved once from the UI before starting the copy, rather than individually within each background task.

Adds a confirmation prompt that warns the user if any application folders already exist in the destination, allowing them to choose whether to overwrite them. The copy logic is updated to remove existing folders before copying to ensure a clean state.
2025-07-17 17:17:00 -07:00
rbalsleyMSFT 62b4816498 Improves application orchestration and BYO app handling
Enhances the orchestrator script to skip application installation steps if no corresponding app lists or files are present. This prevents unnecessary script executions and cleans up the output log.

Makes the 'Arguments' field optional when adding a 'Bring Your Own' application, simplifying the process for apps without arguments.

Ensures the 'Priority' field for applications is consistently saved as an integer to improve data integrity.
2025-07-17 16:50:38 -07:00
rbalsleyMSFT 56c811ad89 Forces capture media creation when installing apps
Removes the check for a pre-existing capture ISO when applications are being installed.

This change simplifies the logic by unconditionally creating the capture media if `InstallApps` is enabled. This ensures the media is always correctly configured for capturing the virtual machine to an FFU.
2025-07-17 12:22:04 -07:00
rbalsleyMSFT 71b3989083 Adds support for custom Office configuration XML
Introduces the ability to use a custom XML file for Office installation, allowing for more flexible configurations.

The build script now accepts an `OfficeConfigXMLFile` parameter. If provided, its filename will be used for the installation.

The Office Deployment Toolkit is now downloaded to the specified Office path instead of the development path. UI tooltips are updated to clarify this behavior.
2025-07-16 18:04:17 -07:00
rbalsleyMSFT e753344137 Refine Office configuration tooltips
Improves the tooltips for the Office installation path and configuration XML options.

The updated text provides clearer guidance on the purpose and usage of these settings.
2025-07-16 15:06:42 -07:00
rbalsleyMSFT bc32a8a10e Adds browse button for Office configuration file
Implements the click handler for the browse button associated with the Office configuration XML file path.

This change enables users to select the configuration file via a file dialog, automatically populating the path into the text field and improving usability.
2025-07-16 14:09:16 -07:00
rbalsleyMSFT 906f73f303 Refine driver models status column header
Shortens the "Download Status" column header to "Status" for a more concise UI.
2025-07-16 13:39:15 -07:00
rbalsleyMSFT d84c307593 Ensure capture media exists for app installation
Forces the creation of capture media if app installation is enabled and the capture ISO does not already exist.

This change prevents a failure later in the build process by ensuring the necessary media is available.
2025-07-16 13:30:12 -07:00
rbalsleyMSFT de8524b37c Refactor USB creation to use parallel processing
Improves the performance of creating multiple deployment USB drives by refactoring the process to run in parallel using `ForEach-Object -Parallel`.

Key changes:
- Mounts the deployment ISO once before processing begins, rather than for each individual drive.
- Partitions, formats, and copies files to multiple USB drives concurrently, significantly reducing the total time required.
- Simplifies and cleans up the FFU selection logic.
- Standardizes on `robocopy` for all large file transfer operations to improve performance and logging.
2025-07-16 13:05:22 -07:00
rbalsleyMSFT c67d8761e2 Fix ambiguous Windows Release selection on config load
Refines the logic for setting the Windows Release from a saved configuration to handle ambiguous values.

When a release value like '2019' exists for both Server and LTSC editions, the UI could select the wrong item. The logic now inspects the `WindowsSKU` config value to differentiate between them, correctly selecting the LTSC or non-LTSC release.
2025-07-16 11:27:21 -07:00
rbalsleyMSFT 7600ae86d1 Refactor update file discovery and cache comparison
Improves the reliability of finding update files (CU, CUP, .NET) by first using the exact filename from the update metadata. The script now only falls back to searching by KB article ID if the primary method fails.

Additionally, this enhances the VHDX cache lookup logic. The comparison now uses update file names extracted directly from their URLs, ensuring a more accurate match against the cached configuration.
2025-07-15 20:04:12 -07:00
rbalsleyMSFT 97e0998e1d Refactor update handling to improve VHDX caching logic
Separates the process of identifying required Windows updates from the download process itself. This allows for checking against the VHDX cache using a list of required updates before any files are downloaded, making the caching mechanism more efficient and reliable.

This change introduces a new `Get-UpdateFileInfo` function to gather update metadata. The main script logic is updated to first determine all necessary updates, then check for a suitable cached VHDX, and only download the updates if no valid cache item is found.
2025-07-15 17:43:08 -07:00
rbalsleyMSFT 5b85acbd73 Refactor(UI): Reorder tabs for a more logical workflow
Moves the "Build" tab to appear after the "Hyper-V Settings" tab. This change aligns the UI with the typical user process, creating a more intuitive sequence for configuration.
2025-07-14 18:09:59 -07:00
rbalsleyMSFT ca84f4dfea Implement conditional autoscroll in log monitor
Improves the user experience in the monitor tab by making the log output autoscroll conditional.

Autoscrolling is now disabled when the user selects a log entry other than the last one, allowing them to inspect previous output without interruption. Selecting the last item in the list re-enables autoscrolling.
2025-07-14 17:56:51 -07:00
rbalsleyMSFT 315f0f3858 Refactor: Remove unused BITS transfer function
Removes the `Start-BitsTransferWithRetry` function as it is no longer in use. This change cleans up the script by removing dead code.
2025-07-14 16:57:11 -07:00
rbalsleyMSFT 21d5f74dd8 Feat: Auto-save selected drivers and refine script execution
Adds a feature to automatically save the selected drivers to `Drivers.json` upon download, preserving the user's selection for future use.

Improves script execution by:
- Ensuring the disk cleanup process completes before proceeding.
- Suppressing progress bars globally for a cleaner console output.
- Hiding non-critical warnings during driver installation.
- Removing an unused BITS transfer function and trailing whitespace.
2025-07-14 16:55:15 -07:00
rbalsleyMSFT 08c9d5a0e3 feat: Add progress reporting to FFU build process
Introduces a progress reporting system to provide real-time feedback during the FFU build. This includes adding a progress bar and status messages to the UI, which are updated at key stages of the build process.

- Adds a new `Set-Progress` function to log progress updates.
- Integrates `Set-Progress` calls throughout the main build script.
- Updates the UI to parse progress logs and update the progress bar and status text.
- Improves error reporting in the UI to display more detailed failure reasons.
- Corrects a typo in the `LogicalSectorSizeBytes` parameter name in documentation and log messages.
2025-07-11 16:43:42 -07:00
rbalsleyMSFT 4a719b6c9a Improves reliability of build log monitoring
Deletes the old log file before starting a new build job to prevent the UI from displaying stale content from a previous run.

Replaces a fixed delay with a more robust wait loop that polls for the new log file's creation. This avoids a race condition where the monitor could fail to attach if the background job was slow to start. A timeout is included to prevent the UI from hanging.
2025-07-10 21:59:19 -07:00
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