2016-09-22 12:43:57 +00:00
---
title: About the windows_feature Resource
---
# windows_feature
Use the `windows_feature` InSpec audit resource to test features on Windows via the `Get-WindowsFeature` cmdlet.
2016-09-27 19:03:23 +00:00
## Syntax
2016-09-22 12:43:57 +00:00
A `windows_feature` resource block declares the name of the Windows feature, tests if that feature is installed, and then returns information about that feature:
describe windows_feature('feature_name') do
it { should be_installed }
end
where
* `('feature_name')` must specify a Windows feature name, such as `DHCP Server` or `IIS-Webserver`
* `be_installed` is a valid matcher for this resource
2016-09-27 19:03:23 +00:00
## Matchers
2016-09-22 12:43:57 +00:00
This InSpec audit resource has the following matchers:
2016-09-27 19:03:23 +00:00
### be
2016-09-22 12:43:57 +00:00
<%= partial "/shared/matcher_be" %>
2016-09-27 19:03:23 +00:00
### be_installed
2016-09-22 12:43:57 +00:00
The `be_installed` matcher tests if the named Windows feature is installed:
it { should be_installed }
2016-09-27 19:03:23 +00:00
### cmp
2016-09-22 12:43:57 +00:00
<%= partial "/shared/matcher_cmp" %>
2016-09-27 19:03:23 +00:00
### eq
2016-09-22 12:43:57 +00:00
<%= partial "/shared/matcher_eq" %>
2016-09-27 19:03:23 +00:00
### include
2016-09-22 12:43:57 +00:00
<%= partial "/shared/matcher_include" %>
2016-09-27 19:03:23 +00:00
### match
2016-09-22 12:43:57 +00:00
<%= partial "/shared/matcher_match" %>
2016-09-27 19:03:23 +00:00
## Examples
2016-09-22 12:43:57 +00:00
The following examples show how to use this InSpec audit resource.
2016-09-27 19:03:23 +00:00
### Test the DHCP Server feature
2016-09-22 12:43:57 +00:00
describe windows_feature('DHCP Server') do
it{ should be_installed }
end