Commit Graph

607 Commits

Author SHA1 Message Date
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
rbalsleyMSFT 93f6eeac87 Improves Winget search performance and user feedback
Refactors the Winget search functionality to enhance performance and provide a better user experience.

- Updates the UI to show a wait cursor, disable the search button, and display a status message during the search operation.
- Improves the post-search status message to differentiate between new and total applications found.
- Utilizes `ForEach-Object -Parallel` to speed up the processing of search results on multi-core systems.
2025-07-24 15:24:01 -07:00
rbalsleyMSFT 138fd1184c Remove debugging code
Removes temporary debug logging from the UI window's closed event handler.
2025-07-24 10:38:08 -07:00
rbalsleyMSFT 0f0e8e9f98 Reduces log noise for monitor tab auto-scroll
Removes the log message that is generated when auto-scrolling is enabled. This reduces log spam, as this can be a frequent event.

The message for when a user manually disables auto-scrolling is retained.
2025-07-24 09:39:10 -07:00
rbalsleyMSFT 576c0a82f8 Improve script output readability
Adds a blank line after each application installation command. This visually separates the output for each app, making the logs easier to read in the terminal.
2025-07-23 20:56:36 -07:00
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 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