Author Posts

March 13, 2017 at 10:11 pm

Hi,

Im trying to install multiple windows features using a DSC scripts passing the list of features via a get content cmdlet

$Nodes = @(
    @{ NodeName = "LocalHost"; Role = "Development"; PSDscAllowPlainTestPassword = $True; },
    @{ NodeName = "*"; Features = (Get-Content "C:\ScriptFiles\features.txt")}
          )

$Configuration = @{AllNodes = $Nodes;PSDscAllowPlainTextPassword = $true}

And then using the foreach windows feature to install each feature in turn:

 $Node.Features.Foreach({
             WindowsFeature $_
                            {
                                Name = $_
                                Ensure = "Present"
                                DependsOn = "[WINDOWSFEATURE]DotNET3.5"
                            }
                            })

But when i execute the script, it process the rest of the script without any problems but when it runs the install windows features i get the following error:

powershell provider MSFT_RoleResource failed to execute the Test-TargetResource functionality with error message: The requested feature is not found on the target machine

So i removed the get-content cmdlet and replaced with each feature individually:

$Nodes = @(
    @{ NodeName = "LocalHost"; Role = "Development"; PSDscAllowPlainTestPassword = $True; },
    @{ NodeName = "*"; Features = "IIS-WebServerRole","IIS-WebServer"}
          )

$Configuration = @{AllNodes = $Nodes;PSDscAllowPlainTextPassword = $true}

But i still get the same issue?

Any ideas?

Thanks

Tommy

March 14, 2017 at 7:34 pm

Web Server features typically start with Web, not IIS. Try using the get-WindowsFeature cmdlet to identify the exact names of the features you are trying to install and use those names in your hashtable.