How do I use WindowsFeatureSet?

This topic contains 8 replies, has 2 voices, and was last updated by Profile photo of GS GS 4 months, 3 weeks ago.

Viewing 9 posts - 1 through 9 (of 9 total)
  • Author
    Posts
  • #38598
    Profile photo of GS
    GS
    Participant

    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]: 
    
    #38606
    Profile photo of Arie H
    Arie H
    Participant

    Two things that come to mind:

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

    2. Add a Node localhost wrapping the WindowsFeatureSet

    #38607
    Profile photo of GS
    GS
    Participant

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

    #38619
    Profile photo of Arie H
    Arie H
    Participant

    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 😉

    #38623
    Profile photo of GS
    GS
    Participant

    That's exactly what I have which is failing.

    #38625
    Profile photo of Arie H
    Arie H
    Participant

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

    #38626
    Profile photo of GS
    GS
    Participant

    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

    #38628
    Profile photo of Arie H
    Arie H
    Participant

    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

    #38630
    Profile photo of GS
    GS
    Participant

    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 
    
Viewing 9 posts - 1 through 9 (of 9 total)

You must be logged in to reply to this topic.