Skip to content

Latest commit

 

History

History
159 lines (123 loc) · 4.04 KB

WindowsFeatures.adoc

File metadata and controls

159 lines (123 loc) · 4.04 KB

DSC Resource 'WindowsFeatures'

WindowsFeatures installs Windows Features on a Windows Server OS.

Source

DSC Resource

Documentation

Requirements
  • Target machine must be running Windows Server 2008 or later.

  • Target machine must have access to the DISM PowerShell module.

  • Target machine must have access to the ServerManager module (provided by default on Windows Server).

Table 1. Attributes of category 'WindowsFeatures'
Parameter Attribute DataType Description Allowed Values

Names

String[]

Indicates the name of the role or feature that you want to ensure is added or removed.

This is the same as the Name property from the Get-WindowsFeature cmdlet, and not the display name of the role or feature.

[+ | -]<name>

Features

Hashtable[]

List windows features with additional properties

Table 2. Attributes of category 'WindowsFeatures/Features'
Parameter Attribute DataType Description Allowed Values

Name

Key

Indicates the name of the role or feature that you want to ensure is added or removed.

This is the same as the Name property from the Get-WindowsFeature cmdlet, and not the display name of the role or feature.

Credential

PSCredential

Indicates the credentials to use to add or remove the role or feature.

IncludeAllSubFeature

Boolean

Set this property to True to ensure the state of all required subfeatures with the state of the feature you specify with the Name property.

  • True

  • False

Source

String

Specifies the path to feature files, if the files are not available in the local feature store of the target computer or VHD.

Valid values for this parameter are either a network path or the path to a Windows image file (WIM).

LogPath

String

Indicates the path to a log file where you want the resource provider to log the operation.

Ensure

String

Indicates if the role or feature is added.

To ensure that the role or feature is added, set this property to Present. To ensure that the role or feature is removed, set the property to Absent.

  • Present (default)

  • Absent

UseLegacyResource

String

Indicates if the resource WindowsFeature should be used instead of the xWindowsFeature resource.

  • false (default)

  • true

Example
WindowsFeatures:
  Names:
  - Hyper-V       # installs WindowsFeature Hyper-V
  - +DHCP         # installs WindowsFeature DHCP Server
  - -Web-Server   # removes WindowsFeature Web-Server (IIS)
  - *Web-Server   # installs WindowsFeature Web-Server (IIS) with all sub features.
  Features:
    - Name: NET-Framework-Core
      Source: \\contoso.com\InstallationSources\WinSxs
      UseLegacyResource: true
    - Name: RSAT-AD-Tools
      IncludeAllSubFeature: true
Recommended Lookup Options in Datum.yml (Excerpt)
default_lookup_options: MostSpecific

lookup_options:

  WindowsFeatures:
    merge_hash: deep
  WindowsFeatures\Names:
    merge_basetype_array: Unique
  WindowsFeatures\Features:
    merge_hash_array: UniqueKeyValTuples
    merge_options:
      tuple_keys:
        - Name