Background I wrote a cookbook that installs Windows Features. Some of the features have dependencies on parent features. The parent features may not have the source files required to install the feature.
Within my recipe, I use only_if to call a Powershell command to determine if the source files exist.
(Get-WindowsFeature | Where Name -eq NET-Framework-Core | Select InstallState).InstallState -eq 'Removed'
If the Install State is equal to Removed, the dependent feature does not have the required source files and cannot be installed without supplying them. So, if my cookbook determines the source files are missing, it will not attempt to install the features. However, if the source files do exist, the cookbook will install the features. This part is working perfectly.
Problem I have InSpec tests to verify the correct Windows features were installed. I want to run or skip specific tests using the result of the Powershell command. I cannot figure out a way to call the Powershell command above, get the results and run or skip the tests within InSpec.