2016-09-22 12:43:57 +00:00
---
title: About the windows_feature Resource
2018-02-16 00:28:15 +00:00
platform: windows
2016-09-22 12:43:57 +00:00
---
# windows_feature
Use the `windows_feature` InSpec audit resource to test features on Windows via the `Get-WindowsFeature` cmdlet.
2017-10-03 21:35:10 +00:00
<br>
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
2017-10-03 21:35:10 +00:00
<br>
2016-09-22 12:43:57 +00:00
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.
2018-07-25 20:00:06 +00:00
### Test the DHCP feature (Attempts PowerShell then DISM)
2016-09-22 12:43:57 +00:00
2018-07-25 20:00:06 +00:00
describe windows_feature('DHCP') do
it{ should be_installed }
end
### Test the IIS-WebServer feature using DISM
describe windows_feature('IIS-WebServer', DISM) do
it{ should be_installed }
end
### Test the NetFx3 feature using DISM
describe windows_feature('NetFx3', :dism) do
2016-09-22 12:43:57 +00:00
it{ should be_installed }
end
2017-10-03 21:35:10 +00:00
<br>
## Matchers
2018-02-16 03:07:18 +00:00
For a full list of available matchers, please visit our [matchers page](https://www.inspec.io/docs/reference/matchers/).
2017-10-03 21:35:10 +00:00
### be_installed
The `be_installed` matcher tests if the named Windows feature is installed:
it { should be_installed }