Sha256: 244f20a2d2e7cc63a8f27dd93f3565c99b5cf33a8b757e0a139c2d4cef68f432

Contents?: true

Size: 1.13 KB

Versions: 5

Compression:

Stored size: 1.13 KB

Contents

---
title: About the windows_feature Resource
platform: windows
---

# windows_feature

Use the `windows_feature` InSpec audit resource to test features on Windows via the `Get-WindowsFeature` cmdlet.

<br>

## 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

<br>

## 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

<br>

## Matchers

For a full list of available matchers, please visit our [matchers page](https://www.inspec.io/docs/reference/matchers/).

### be_installed

The `be_installed` matcher tests if the named Windows feature is installed:

    it { should be_installed }

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
inspec-2.1.81 docs/resources/windows_feature.md.erb
inspec-2.1.21 docs/resources/windows_feature.md.erb
inspec-2.1.10 docs/resources/windows_feature.md.erb
inspec-2.0.32 docs/resources/windows_feature.md.erb
inspec-2.0.17 docs/resources/windows_feature.md.erb