From 6441556b98cf80b1308c9ac443c4434979a2fff2 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'."} --- lib/ansible/modules/windows/win_feature.ps1 | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/ansible/modules/windows/win_feature.ps1 b/lib/ansible/modules/windows/win_feature.ps1 index 62960d581e3..339b79b9d7b 100644 --- a/lib/ansible/modules/windows/win_feature.ps1 +++ b/lib/ansible/modules/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 }