Errors when trying to install windows features

This topic contains 1 reply, has 2 voices, and was last updated by  Missy Januszko 9 months, 1 week ago.

  • Author
    Posts
  • #66319

    TommyQuality
    Participant

    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

  • #66396

    Missy Januszko
    Participant

    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.

You must be logged in to reply to this topic.