windowsfeature
Version information
This version is compatible with:
- Puppet Enterprise 2023.8.x, 2023.7.x, 2023.6.x, 2023.5.x, 2023.4.x, 2023.3.x, 2023.2.x, 2023.1.x, 2023.0.x, 2021.7.x, 2021.6.x, 2021.5.x, 2021.4.x, 2021.3.x, 2021.2.x, 2021.1.x, 2021.0.x
- Puppet >= 7.0.0 < 9.0.0
Start using this module
Add this module to your Puppetfile:
mod 'puppet-windowsfeature', '5.0.0'
Learn more about managing modules with a PuppetfileDocumentation
puppet-windowsfeature
Table of Contents
- Overview
- Module Description - What the module does and why it is useful
- Setup - The basics of getting started with windowsfeature
- Usage - Configuration options and additional functionality
- Reference - An under-the-hood peek at what the module is doing and how
- Limitations - OS compatibility, etc.
- Development - Guide for contributing to the module
Overview
The windowsfeature module allows you to install/remove windows features.
Module Description
The windowsfeature module introduces a new windowsfeature
type uses the ServerManager API that comes with Windows Server 2008 R2 onward to add/remove Windows features.
For a list of the windows features you can install, please visit this technet article
Setup
What windowsfeature affects
- Installs windows features (and optionally corresponding tools)
Setup Requirements
- windowsfeature makes use of Powershell so you will need to have at least version 2.0 installed in order to use this module.
Usage
To install a single windows feature such as .NET 3.5:
windowsfeature { 'NET-Framework-Core':
ensure => present,
}
To install several windows features as part of a large application such IIS:
$iis_features = ['Web-Server','Web-WebServer','Web-Asp-Net45','Web-ISAPI-Ext','Web-ISAPI-Filter','NET-Framework-45-ASPNET','WAS-NET-Environment','Web-Http-Redirect','Web-Filtering','Web-Mgmt-Console','Web-Mgmt-Tools']
windowsfeature { $iis_features:
ensure => present,
}
To install any associated management tools:
windowsfeature { 'Web-WebServer':
ensure => present,
installmanagementtools => true,
}
To install all subfeatures without having to list them all out:
windowsfeature { 'Web-WebServer':
ensure => present,
installsubfeatures => true,
}
To install a feature and reboot if one is pending:
windowsfeature { 'RDS-RD-Server':
ensure => present,
}
reboot {'after_RDS_RD_Server':
when => pending,
subscribe => Windowsfeature['RDS-RD-Server'],
}
DEPRECATION NOTICE: The restart parameter has been deprecated in favor of the puppetlabs reboot module ( https://github.com/puppetlabs/puppetlabs-reboot ). This parameter will be removed in the next release.
Reference
Types
Parameters are optional unless otherwise noted.
windowsfeature
ensure
Specifies whether the feature should be present. Valid options: 'present', 'installed' and 'absent'.
Default: 'present'.
name
Required.
The name of the feature you want to manage.
installmanagementtools
Specifies that all applicable management tools of the roles, role services, or features specified by the Name parameter should be installed. Note: Although management tools are installed by default when you are installing features by using the UI, management tools are not installed by default when you install features by using the Install-WindowsFeature cmdlet; this parameter must be added to install management tools.
installsubfeatures
Specifies that all subordinate role services, and all subfeatures of parent roles, role services, or features specified by the Name parameter should be installed.
restart
Specifies that the target system is restarted automatically, if a restart is required by the installation process for the specified roles or features.
source
Specify the location of an installation source. The source must be from the exact same version of Windows for the reinstallation to work. Without this parameter, PowerShell will use Windows Update by default to look for an installation source
Upgrading from 1.0.1 Release
Previously, the windows features were managed by individual execs:
exec { "add-feature-${title}":
command => "Import-Module ServerManager; ${command} ${features} ${_installmanagementtools} ${_installsubfeatures} ${_installsource} -Restart:$${_restart}",
onlyif => "Import-Module ServerManager; if (@(Get-WindowsFeature ${features} | ?{\$_.Installed -match \'false\'}).count -eq 0) { exit 1 }",
provider => powershell,
timeout => $timeout,
}
This lead to long execution times when managing a large amount of features, even after features were installed, as the Powershell would have to run the onlyif command for every check.
The new 2.0.0 release uses native types and providers, which speeds up the time as it can just compare the resources on the machine with the results from Get-WindowsFeature.
For example, enabling all the Windows features for a standard IIS setuo after features are installed (ie. an idempotent run):
1.0.0 release:
win-2012R2-std 01:29:30$ puppet apply --verbose --detailed-exitcodes C:\Windows\Temp\apply_manifest.pp.8276
Info: Loading facts
Notice: Compiled catalog for win-2012r2-std.home in environment production in 0.44 seconds
Info: Applying configuration version '1464136176'
Notice: Finished catalog run in 15.30 seconds
win-2012R2-std 01:29:30$ puppet apply --verbose --detailed-exitcodes C:\Windows\Temp\apply_manifest.pp.8276
Info: Loading facts
Notice: Compiled catalog for win-2012r2-std.home in environment production in 0.44 seconds
Info: Applying configuration version '1464136176'
Notice: Finished catalog run in 3.34 seconds
So that's a third of the original runs time! And this would only increase with larger amounts of features, as the more features to check, the longer it would take.
Another benefit is this module now has less dependancies on other modules, as it's all native to the module now.
Limitations
This module is tested on the following platforms:
- Windows 2008 R2
- Windows 2012
- Windows 2012 R2
- Windows 2016
It is tested with the OSS version of Puppet only.
Known issues
- Specifying installmanagementtools and/or installsubfeatures when a feature is already installed will not install said management tools or sub features.
Contributing
Please read CONTRIBUTING.md for full details on contributing to this project.
Reference
Table of Contents
Resource types
Resource types
windowsfeature
The windowsfeature type.
Properties
The following properties are available in the windowsfeature
type.
ensure
Valid values: present
, absent
The basic property that the resource should be in.
Default value: present
Parameters
The following parameters are available in the windowsfeature
type.
installmanagementtools
Valid values: true
, false
, yes
, no
installsubfeatures
Valid values: true
, false
, yes
, no
name
namevar
provider
The specific backend to use for this windowsfeature
resource. You will seldom need to specify this --- Puppet will
usually discover the appropriate provider for your platform.
restart
Valid values: true
, false
, yes
, no
source
Changelog
All notable changes to this project will be documented in this file. Each new release typically also includes the latest modulesync defaults. These should not affect the functionality of the module.
v5.0.0 (2024-02-16)
Breaking changes:
- Drop Puppet 6 support #153 (bastelfreak)
Implemented enhancements:
- Add Puppet 8 support #155 (bastelfreak)
v4.0.0 (2022-06-03)
Breaking changes:
- modulesync 5.3.0; Drop Puppet 5 support #147 (bastelfreak)
- modulesync 2.7.0 and drop puppet 4 #131 (bastelfreak)
Implemented enhancements:
- Puppet 7 support #143
Fixed bugs:
- Ignore powershell progress screens #136 (trevor-vaughan)
Closed issues:
- Error: Could not prefetch windowsfeature provider 'default': returned 1 #146
- Errors during feature install on Windows 2019 #138
Merged pull requests:
- Dependency and Support Bump #148 (trevor-vaughan)
- (GH-143) Add puppet 7 support #145 (TraGicCode)
- Ignore PowerShell progress bar #139 (Andy-Adrian)
- Remove duplicate CONTRIBUTING.md file #133 (dhoppe)
- Remove Linux acceptance nodesets #128 (ekohl)
v3.2.2 (2018-10-19)
Fixed bugs:
- Targeted Deprecation Notice of Restart parameter (#120) #122 (fiveshotsofespresso)
Closed issues:
- The restart parameter has been deprecated in favor of the puppetlabs reboot module ( https://github.com/puppetlabs/puppetlabs-reboot ). This parameter will be removed in the next release. (location: C:/ProgramData/PuppetLabs/puppet/cache/lib/puppet/type/windowsfeature.rb:20:in `block (2 levels) in \<top (required)>') shows every run #120
v3.2.1 (2018-09-07)
Merged pull requests:
- Remove docker nodesets #119 (bastelfreak)
- drop EOL OSs; fix puppet version range #118 (bastelfreak)
v3.2.0 (2018-02-13)
Implemented enhancements:
- Add support and code for windows 2008 non-r2 #104
Fixed bugs:
Closed issues:
- Windowsfeature gives Corrective change every time #111
- UTF8 error with french windows 2012 #109
- Missing release #107
Merged pull requests:
- release 3.2.0 #115 (bastelfreak)
- Resolve UTF8 problem with PowerShell output #112 (ahotton)
v3.1.0 (2017-09-22)
Closed issues:
Merged pull requests:
- 3.1.0 release #105 (TraGicCode)
- Remove Windows 2008 Support and Add Windows 2016 Support #103 (TraGicCode)
- Deprecation notice for the restart parameter #102 (TraGicCode)
- Fixing readme markdown formatting issues #99 (TraGicCode)
v3.0.0 (2017-09-18)
Fixed bugs:
- Invalid XML being returned on Windows 2008 R2 for get-windowsfeature #86
- Source parameter throwing an error #80
Merged pull requests:
- Release 3.0.0 #95 (TraGicCode)
- Refactor Hacky boolean validation #93 (TraGicCode)
- In a windows only module we don't want non-windows nodesets #92 (TraGicCode)
- (GH-86) Fix invalid XML from Get-WindowsFeature #88 (jarretlavallee)
- (GH-85) Fix typo in provider for source parameter #85 (glennsarti)
- Fixed source parameter in provider create #81 (cargiris)
Changelog
v2.1.0 (2017-02-11)
This is the last release with Puppet3 support!
- Switched everything over to XML and updated tests.
- some fixes from getting rid of trying flush
- Converted from CSV to XML - Resolved merge conflict
- Set minimum version_requirement for Puppet
v2.0.2 (2016-08-18)
Summary
Switched from CSV to XML
v2.0.1 (2016-07-13)
Summary
A bug fix to support Windows 2008
Features
- moved from PowerShell JSON conversion to CSV for Windows 2008 support (#57)
v2.0.0 (2016-06-16)
Summary
- modulesync with latest voxpupuli settings (#46, #51)
- Drop of Ruby1.8!
- Enhanced Unit/Acceptance tests (#47, #53)
Features
- windowsfeature as native Type and Provider (#47)
v1.1.0 (2015-05-01)
Summary
A few small features in this release. First release under the new puppet-community namespace
Features
- added new timeout
parameter
for features that take longer than the default 300 seconds to complete. - added support for kernelversion 10 for people deploying on Windows 10
v1.0.0 (2014-10-13)
Summary
Finally bumping to 1.0.
Features
- adding
source
paramater - updating documentation
v0.2.0 (2014-08-14)
Summary
Small release to bump stdlib dependency to be 4.0 minimum
v0.1.2 (2014-04-14)
Summary
This release fixes some minor idempotency and platform specific bugs
Bugfixes
- fixing idempotency
- fixed installation on windows 2008
v0.1.1 (2014-04-04)
Summary
This release adds support for windows 2012
v0.1.0 (2014-04-04)
Summary
This release adding some new parameters to install sub features and management tools
Features
- added
includemanagementtools
andincludesubfeatures
parameters
Bugfixes
- limit module usage for Windows 2008 R2 and newer versions of Windows
v0.0.3 (2014-03-30)
Summary
This release replaces all the hardcoded powershell with uses of the joshcopper/powershell provider
v0.0.2 (2014-01-19)
Summary
Initial version.
* This Changelog was automatically generated by github_changelog_generator
Copyright (c) 2014 OpenTable, Inc. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.