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'."}
This commit is contained in:
Daniel Petty 2016-05-25 17:00:12 -06:00 committed by Matt Clay
parent a522c2d99f
commit 6441556b98

View file

@ -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
}