* `class`, `namespace`, `filter`, and `query` comprise a Ruby Hash of the WMI object
* `('class')` is the WMI class to which the setting belongs, such as `win32_service`
* `('namespace')` is path to that object, such as `root\\cimv2`
* Use `('filter')` fine-tune the information defined by the WMI class, such as to find a specific service (`filter: "name like '%winrm%'")`, to find a specific setting (`filter: 'KeyName = \'MinimumPasswordAge\' And precedence=1'`), and so on
* Use `('query')` to run a query that returns data to be tested, such as `"SELECT Setting FROM RSOP_SecuritySettingBoolean WHERE KeyName='LSAAnonymousNameLookup' AND Precedence=1"`
* `('setting_name')` is a setting in the WMI object to be tested, and then `should eq ''` is the expected value for that setting
For example, both of the following tests will verify if WinRM is present on the target node. The first tests if WinRM belongs to the list of services running under the `win32_service` class:
describe wmi({class: 'win32_service'}) do
its('DisplayName') { should include 'Windows Remote Management (WS-Management)'}
end
and the second uses a filter in the Ruby Hash to first identify WinRM, and then perform additional tests:
describe wmi({
class: 'win32_service',
filter: "name like '%winrm%'"
}) do
its('Status') { should cmp 'ok' }
its('State') { should cmp 'Running' }
its('ExitCode') { should cmp 0 }
its('DisplayName') { should eq 'Windows Remote Management (WS-Management)'}