Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add wmi resource #560

Merged
merged 5 commits into from
Mar 20, 2016
Merged

add wmi resource #560

merged 5 commits into from
Mar 20, 2016

Conversation

chris-rock
Copy link
Contributor

The new WMI resource allows users to query Windows Management Instrumentation (WMI). Under the hood we use Powershell to retrieve the information:

# Get-WmiObject -class win32_service
# returns an array of results
describe wmi('win32_service') do
  its(['Path','ClassName']) { should include 'Win32_Service' }
  its('DisplayName') { should include 'Windows Remote Management (WS-Management)'}
end

# Its also possible to add filter to narrow down the result set
# therefore we can use `eq` instead of `include` here
describe wmi('win32_service', {
  filter: "name like '%winrm%'"
}) do
  its(['Path','ClassName']) { should eq 'Win32_Service' }
  its('DisplayName') { should eq 'Windows Remote Management (WS-Management)'}
end

end

# if there are no more keys, just return the value
return value if keys.first.nil?
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Isn't this redundant?

@arlimus
Copy link
Contributor

arlimus commented Mar 20, 2016

Awesome to get WMI for Windows, thank you @chris-rock !!

arlimus added a commit that referenced this pull request Mar 20, 2016
@arlimus arlimus merged commit 1577265 into master Mar 20, 2016
@arlimus arlimus deleted the chris-rock/wmi branch March 20, 2016 11:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Type: Enhancement Improves an existing feature
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants