Sha256: 149e322cdbde1584a86923be81849f4d770f516af3bf6323a861e0fa1e02c311

Contents?: true

Size: 1.08 KB

Versions: 36

Compression:

Stored size: 1.08 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

36 entries across 36 versions & 2 rubygems

Version Path
inspec-core-2.2.41 docs/resources/windows_feature.md.erb
inspec-2.2.41 docs/resources/windows_feature.md.erb
inspec-core-2.2.35 docs/resources/windows_feature.md.erb
inspec-2.2.35 docs/resources/windows_feature.md.erb
inspec-core-2.2.34 docs/resources/windows_feature.md.erb
inspec-2.2.34 docs/resources/windows_feature.md.erb
inspec-core-2.2.27 docs/resources/windows_feature.md.erb
inspec-2.2.27 docs/resources/windows_feature.md.erb
inspec-core-2.2.20 docs/resources/windows_feature.md.erb
inspec-2.2.20 docs/resources/windows_feature.md.erb
inspec-core-2.2.16 docs/resources/windows_feature.md.erb
inspec-2.2.16 docs/resources/windows_feature.md.erb
inspec-core-2.2.10 docs/resources/windows_feature.md.erb
inspec-2.2.10 docs/resources/windows_feature.md.erb
inspec-core-2.1.84 docs/resources/windows_feature.md.erb
inspec-2.1.84 docs/resources/windows_feature.md.erb
inspec-core-2.1.83 docs/resources/windows_feature.md.erb
inspec-2.1.83 docs/resources/windows_feature.md.erb
inspec-core-2.1.81 docs/resources/windows_feature.md.erb
inspec-core-2.1.80 docs/resources/windows_feature.md.erb