Module: Facter::Util::WMI

Defined in:
lib/facter/util/wmi.rb

Class Method Summary collapse

Class Method Details

.connect(uri = wmi_resource_uri) ⇒ Object



3
4
5
6
# File 'lib/facter/util/wmi.rb', line 3

def connect(uri = wmi_resource_uri)
  require 'win32ole'
  WIN32OLE.connect(uri)
end

.execquery(query) ⇒ Object



12
13
14
# File 'lib/facter/util/wmi.rb', line 12

def execquery(query)
  connect().execquery(query)
end

.wmi_resource_uri(host = '.') ⇒ Object



8
9
10
# File 'lib/facter/util/wmi.rb', line 8

def wmi_resource_uri( host = '.' )
  "winmgmts:{impersonationLevel=impersonate}!//#{host}/root/cimv2"
end