# Errors when trying to install windows features

**URL:** <https://forums.powershell.org/t/errors-when-trying-to-install-windows-features/8222>\
**Category:** DSC\
**Created:** [March 13, 2017, 4:41pm UTC](https://forums.powershell.org/t/errors-when-trying-to-install-windows-features/8222 "2017-03-13T16:41:18Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![incognitotom](https://avatars.discourse-cdn.com/v4/letter/i/e495f1/32.png) [@incognitotom](https://forums.powershell.org/u/incognitotom)\
**Post date:** [March 13, 2017, 4:41pm UTC](https://forums.powershell.org/t/errors-when-trying-to-install-windows-features/8222/1 "2017-03-13T16:41:18Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![majst32](https://avatars.discourse-cdn.com/v4/letter/m/ecc23a/32.png) [@majst32](https://forums.powershell.org/u/majst32)\
**Post date:** [March 14, 2017, 2:04pm UTC](https://forums.powershell.org/t/errors-when-trying-to-install-windows-features/8222/2 "2017-03-14T14:04:26Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![dotnVo](https://avatars.discourse-cdn.com/v4/letter/d/4af34b/32.png) [@dotnVo](https://forums.powershell.org/u/dotnVo)\
**Post date:** [May 16, 2024, 9:16pm UTC](https://forums.powershell.org/t/errors-when-trying-to-install-windows-features/8222/3 "2024-05-16T21:16:48Z")

</div>


