DSC Windows Feature Web-Ftp-Service

Tuesday, December 3, 2013
by asalvo

This week I've started learning/using Desired State Configuration. I'm sure I will be blogging about it more in the coming weeks, but for now here is a quick overview of installing the FTP Role Feature. One of the built in resources for DSC is WindowsFeature which allows you to enable different features and roles on Windows. A DSC configuration file might look something like this:


  Configuration IISWebsite
  {
    Node Server1, Server2
    {
      WindowsFeature Web-Server
      {
        Ensure    = "Present"
        Name      = "Web-Server"
      }
    }
  }

But what options are there for the Name? Well if you execute the Get-WindowsFeature cmdlet, you will get a nicely formatted list, which lists them all and if they are installed are not. The following list is all the Webrole features from Server 2012 R2. WebFeatures

Most of the examples out there show using a value of Name = 'Web-Server' which corresponds to the Web Role itself but it's not needed. You only need to specify the names for the child nodes and Windows will install the dependencies required.

  Configuration IISWebsite
  {
    Node Server1, Server2
    {
      WindowsFeature Logging
      {
        Ensure    = "Present"
        Name      = "Web-Http-Logging"
      }

      WindowsFeature Ftp
      {
        Ensure    = "Present"
        Name      = Web-Ftp-Service"
      }
    }
  }

And here is the verbose output from Start-DscConfiguration:

DscFtpInstall

Comments

comments powered by Disqus