I am calling the dbatools Install-DbaInstance
function, and one of the parameters is Feature
. I initialize the variable to "Engine". If $bolSSIS -eq $true
, I want to add "IntegrationServices" to the variable. If $bolSSAS -eq $true
, I want to add "AnalysisServices" to the variable.
The code below is not complete, but I believe is enough to explain what I'm trying to do:
$bolSSIS = $true
$bolSSAS = $false
$InstallFeatures = "Engine"
if ($bolInstallFeatureSSIS -eq $true) { $InstallFeatures += ",IntegrationServices" }
if ($bolInstallFeatureSSAS -eq $true) { $InstallFeatures += ",AnalysisServices" }
Install-DbaInstance -Feature $InstallFeatures
The code above returns the error:
Cannot validate argument on parameter 'Feature'. The argument "Engine,IntegrationServices" does not belong to the set "Default,All,Engine,Tools,Replication,FullText,DataQuality,PolyBase,MachineLearning,AnalysisServices,IntegrationServices, {others removed for brevity} " specified by the ValidateSet attribute. Supply an argument that is in the set and then try the command again.
Here's my question: How do I set $InstallFeatures
?
I've tried strings, arrays, hashes, and other variable types.
FWIW, if $InstallFeatures
is set to only "Default", the Install-DbaInstance -Feature $InstallFeatures
command works and does not return an error.