From dc46dc211bee80ae8410bac521d1ebb3375150c7 Mon Sep 17 00:00:00 2001 From: Leonardo Klein Date: Wed, 18 Feb 2026 18:34:16 -0300 Subject: [PATCH] fix: correct WhatIf check in Disable-LanmanCache.ps1 Replace undeclared $WhatIf variable with $WhatIfPreference automatic variable so the restart prompt is properly suppressed during -WhatIf runs. Closes #3 --- Scripts/Registry/Disable-LanmanCache.ps1 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Scripts/Registry/Disable-LanmanCache.ps1 b/Scripts/Registry/Disable-LanmanCache.ps1 index 3dc96c3..c28e4be 100644 --- a/Scripts/Registry/Disable-LanmanCache.ps1 +++ b/Scripts/Registry/Disable-LanmanCache.ps1 @@ -102,7 +102,7 @@ try { Write-Information "LanmanWorkstation cache settings have been disabled successfully." -InformationAction Continue Write-Warning "IMPORTANT: A system restart may be required for changes to take effect." - if (-not $WhatIf) { + if (-not $WhatIfPreference) { $restart = Read-Host "`nWould you like to restart the computer now? (y/N)" if ($restart -eq 'y' -or $restart -eq 'Y') { Write-Information "Initiating system restart..." -InformationAction Continue