Sha256: 19e026ff389813277d7bc8799288839a62cec53da07b8e064170b268219157a9

Contents?: true

Size: 431 Bytes

Versions: 6

Compression:

Stored size: 431 Bytes

Contents

require 'win32ole'

VALUES = ['CategoryString', 'Message', 'TimeGenerated', 'User', 'Type']
query = "select #{VALUES.join(',')} from Win32_NtLogEvent where Logfile = 'Application' and TimeGenerated > '20100713000000.000000-***'"

wmi = WIN32OLE.new "WbemScripting.SWbemLocator"
connection = wmi.connectserver
connection.ExecQuery(query).each do |result|
  puts VALUES.map { |v| "#{v}: #{result.__send__(v).to_s}" }.join(", ")
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
jruby-win32ole-0.8.5 samples/sbem.rb
jruby-win32ole-0.8.4 samples/sbem.rb
jruby-win32ole-0.8.3 samples/sbem.rb
jruby-win32ole-0.8.2 samples/sbem.rb
jruby-win32ole-0.8.1 samples/sbem.rb
jruby-win32ole-0.8.0 samples/sbem.rb