Author Posts

May 4, 2016 at 1:18 pm

Not understanding what am I doing wrong but I can not run following configuration, it keeps asking me to enter Name parameter

Configuration dd
{
    WindowsFeatureSet DefaultIIS {
	    Name = 'FileAndStorage-Services'
    } 
}
dd 

Result is

cmdlet WindowsFeatureSet at command pipeline position 1
Supply values for the following parameters:
Name[0]: 

May 4, 2016 at 2:53 pm

Two things that come to mind:

1. Please add the Ensure='Present' inside the WindowsFeatureSet

2. Add a Node localhost wrapping the WindowsFeatureSet

May 4, 2016 at 2:54 pm

Ensure is optional and Node did not help either, still fails.

May 5, 2016 at 1:55 am

Based on the github repo for when these new cmdlets were added

https://github.com/PowerShell/PowerShell-Docs/commit/49fca7d7f788efe3457208e982dd0bd6d4ade441

And the "vastly" number of examples around, the WindowsFeatureSet is used to enable certain set items of the Windows Feature, so lets say in FileAndStorage-Services you would have a set item called NFS and you only want to install that part, I think you need to use it as such:

Configuration DD
{
   WindowsFeatureSet FileAndStorage-Services
   {
      Name = NFS
   }


}
DD

As I cant test it myself at the moment, I leave that part to you 😉

May 5, 2016 at 4:08 am

That's exactly what I have which is failing.

May 5, 2016 at 4:36 am

The script I wrote isn't the one you posted in the initial question, so I'm puzzled which script you really have.

May 5, 2016 at 4:45 am

May be I'm missing something but the only thing different I see is name of featureset is different and Name property is different bit syntax and use exactly the same

May 5, 2016 at 5:18 am

You have to use the syntax and words I used, name of the feature set has to be that value. As for the Name property inside, you need to put the name of the set you want, NFS was just an invention as I dont know exactly what's inside that windows feature

May 5, 2016 at 6:22 am

Solution was to including Import-DSCResource as well as specify "Ensure" parameter, despite the fact in Syntax help it's showing as "optional", it's actually required. Also all string parameters needs to be enclosed in Quotes.

Configuration dd
{
import-dscresource -name WindowsFeatureSet -ModuleName PSDesiredStateConfiguration
    WindowsFeatureSet "DefaultIIS" {
	    Name = 'FileAndStorage-Services',"Storage-Services","Web-Server" 
Ensure = 'present'
 
    } 
}
dd