From a4e6e6e2ef0b3b7e3314ac9d60a6f3f2bac93f1b Mon Sep 17 00:00:00 2001 From: Daniel Petty Date: Wed, 25 May 2016 17:00:12 -0600 Subject: [PATCH] fixed $source null check, reference to $Params $source check causes: FAILED! => {"changed": false, "failed": true, "msg": "A parameter cannot be found that matches parameter name 'Source'."} $Params.Remove causes: FAILED! => {"changed": false, "failed": true, "msg": "Method invocation failed because [System.Management.Automation.PSCustomObject] does not contain a method named 'Remove'."} --- windows/win_feature.ps1 | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/windows/win_feature.ps1 b/windows/win_feature.ps1 index 62960d581e3..339b79b9d7b 100644 --- a/windows/win_feature.ps1 +++ b/windows/win_feature.ps1 @@ -63,7 +63,7 @@ If ($state -eq "present") { $InstallParams.add("IncludeManagementTools",$includemanagementtools) } - if ($source -ne $null) + if ($source) { $InstallParams.add("Source",$source) } @@ -77,7 +77,7 @@ If ($state -eq "present") { ElseIf (Get-Command "Add-WindowsFeature" -ErrorAction SilentlyContinue) { if ($IncludeManagementTools) { - $Params.Remove("IncludeManagementTools") + $InstallParams.Remove("IncludeManagementTools") } $featureresult = Add-WindowsFeature @InstallParams }