Windows Feature (Sub Features)


#1

Hello, I was writing an Inspec code to verify if a Windows Feature is installed.

describe windows_feature('Web-Server') do
it{ should be_installed }
end

What I also want to test are the sub features, below is the PowerShell output of Get-WindowsFeature command for Web-Server and it shows SubFeatures which I am NOT sure how to include in my Inspec code?

Name : Web-Server
DisplayName : Web Server (IIS)
Installed : True
InstallState : Installed
FeatureType : Role
Path : Web Server (IIS)
Depth :
DependsOn : {}
Parent :
ServerComponentDescriptor : ServerComponent_Web_Server
SubFeatures : {Web-WebServer, Web-Ftp-Server, Web-Mgmt-Tools}
SystemService : {}
Notification : {}

Can someone help please?


#2

Features and sub features are looked at the same from the standpoint of the Inspec code or basic Chef code.

So one option would be to put the features/subfeatures you want to check for in an array and simply loop thru them validating they are installed.


#3

Thanks, I found that out after wasting hours but learnt it.