Module: Facter::Util::WMI

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

Class Method Summary (collapse)

Class Method Details

+ (Object) connect(uri = wmi_resource_uri)



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

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

+ (Object) execquery(query)



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

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

+ (Object) wmi_resource_uri(host = '.')



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

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