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.
This commit is contained in:
rbalsleyMSFT
2025-07-08 18:51:19 -07:00
parent d6689888b2
commit 4ef7c2fb0b
+6
View File
@@ -418,6 +418,12 @@ if (Get-Module -Name 'FFU.Common.Drivers' -ErrorAction SilentlyContinue) {
# Import the required modules # Import the required modules
Import-Module "$PSScriptRoot\FFU.Common" -Force 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 a config file is specified and it exists, load it
if ($ConfigFile -and (Test-Path -Path $ConfigFile)) { if ($ConfigFile -and (Test-Path -Path $ConfigFile)) {
$configData = Get-Content $ConfigFile -Raw | ConvertFrom-Json $configData = Get-Content $ConfigFile -Raw | ConvertFrom-Json