From 1bc7bc4f5d33d6d007b8b566d56c4de03732c3a0 Mon Sep 17 00:00:00 2001 From: Jared Holgate Date: Fri, 9 Jan 2026 12:06:16 +0000 Subject: [PATCH] feat: powershell-yaml module import check --- src/ALZ/Private/Tools/Test-Tooling.ps1 | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/src/ALZ/Private/Tools/Test-Tooling.ps1 b/src/ALZ/Private/Tools/Test-Tooling.ps1 index 4ce700a..1fc9048 100644 --- a/src/ALZ/Private/Tools/Test-Tooling.ps1 +++ b/src/ALZ/Private/Tools/Test-Tooling.ps1 @@ -221,9 +221,19 @@ function Test-Tooling { } if ($yamlModule) { - $checkResults += @{ - message = "powershell-yaml module is installed (version $($yamlModule.Version))." - result = "Success" + # Import powershell-yaml module if not already loaded + if (-not (Get-Module -Name powershell-yaml)) { + Write-Verbose "Importing powershell-yaml module version $($yamlModule.Version)" + Import-Module -Name powershell-yaml -RequiredVersion $yamlModule.Version -Global + $checkResults += @{ + message = "powershell-yaml module is installed but was not imported, now imported (version $($yamlModule.Version))." + result = "Success" + } + } else { + $checkResults += @{ + message = "powershell-yaml module is installed and imported (version $($yamlModule.Version))." + result = "Success" + } } } elseif ($skipYamlModuleInstall.IsPresent) { Write-Verbose "powershell-yaml module is not installed, skipping installation attempt"