From 4ef7c2fb0bcdd03cf20c8e456a88fd9163c84839 Mon Sep 17 00:00:00 2001 From: rbalsleyMSFT <53497092+rbalsleyMSFT@users.noreply.github.com> Date: Tue, 8 Jul 2025 18:51:19 -0700 Subject: [PATCH] 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. --- FFUDevelopment/BuildFFUVM.ps1 | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/FFUDevelopment/BuildFFUVM.ps1 b/FFUDevelopment/BuildFFUVM.ps1 index a29fa2e..1a45fdd 100644 --- a/FFUDevelopment/BuildFFUVM.ps1 +++ b/FFUDevelopment/BuildFFUVM.ps1 @@ -418,6 +418,12 @@ if (Get-Module -Name 'FFU.Common.Drivers' -ErrorAction SilentlyContinue) { # Import the required modules Import-Module "$PSScriptRoot\FFU.Common" -Force +# Set the module's verbose preference to match the script's - allows logging verbose output to console. +$moduleInfo = Get-Module -Name 'FFU.Common' +if ($moduleInfo) { + & $moduleInfo { $script:VerbosePreference = $args[0] } $VerbosePreference +} + # If a config file is specified and it exists, load it if ($ConfigFile -and (Test-Path -Path $ConfigFile)) { $configData = Get-Content $ConfigFile -Raw | ConvertFrom-Json