mirror of
https://github.com/inspec/inspec
synced 2024-11-27 07:00:39 +00:00
9283f19b6e
Signed-off-by: David Wrede <dwrede@chef.io>
61 lines
1.2 KiB
Text
61 lines
1.2 KiB
Text
---
|
|
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.
|
|
|
|
## Syntax
|
|
|
|
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
|
|
|
|
|
|
## Matchers
|
|
|
|
This InSpec audit resource has the following matchers:
|
|
|
|
### be
|
|
|
|
<%= partial "/shared/matcher_be" %>
|
|
|
|
### be_installed
|
|
|
|
The `be_installed` matcher tests if the named Windows feature is installed:
|
|
|
|
it { should be_installed }
|
|
|
|
### cmp
|
|
|
|
<%= partial "/shared/matcher_cmp" %>
|
|
|
|
### eq
|
|
|
|
<%= partial "/shared/matcher_eq" %>
|
|
|
|
### include
|
|
|
|
<%= partial "/shared/matcher_include" %>
|
|
|
|
### match
|
|
|
|
<%= partial "/shared/matcher_match" %>
|
|
|
|
## Examples
|
|
|
|
The following examples show how to use this InSpec audit resource.
|
|
|
|
### Test the DHCP Server feature
|
|
|
|
describe windows_feature('DHCP Server') do
|
|
it{ should be_installed }
|
|
end
|