diff options
Diffstat (limited to 'lib')
-rw-r--r-- | lib/wmi-lite/wmi.rb | 11 | ||||
-rw-r--r-- | lib/wmi-lite/wmi_instance.rb | 2 |
2 files changed, 11 insertions, 2 deletions
diff --git a/lib/wmi-lite/wmi.rb b/lib/wmi-lite/wmi.rb index 61fd0c3..1acc9bd 100644 --- a/lib/wmi-lite/wmi.rb +++ b/lib/wmi-lite/wmi.rb @@ -54,7 +54,16 @@ module WmiLite private def start_query(wql_query) - @connection.ExecQuery(wql_query) + result = @connection.ExecQuery(wql_query) + raise_if_failed(result) + result + end + + def raise_if_failed(result) + # Attempting to access the count property of the underlying + # COM (OLE) object will trigger an exception if the query + # was unsuccessful. + result.count end def new_connection(namespace) diff --git a/lib/wmi-lite/wmi_instance.rb b/lib/wmi-lite/wmi_instance.rb index a6f7256..ff0e9c6 100644 --- a/lib/wmi-lite/wmi_instance.rb +++ b/lib/wmi-lite/wmi_instance.rb @@ -27,7 +27,7 @@ module WmiLite end def [](key) - @property_map[key] + @property_map[key.downcase] end private |