This is probably enough for the list to look over. What do you guys
think -- idiomatic Ruby or not? Also, if I'm doing anything that's not
safe (should I close 'mgmt' or 'net' somehow) please let me know.
Thanks again for the feedback.
require 'win32ole'
# Get running process names, ids and paths (if present)
mgmt = WIN32OLE.connect("winmgmts:\\\\.")
mgmt.InstancesOf("win32_process").each do |p|
puts p.name.to_s + "\t" +
p.processid.to_s + "\t" +
p.executablepath.to_s
end
puts
# Get the IP, Mac Address and Gateway of Active Network Interfaces.
net = WIN32OLE.connect("winmgmts:\\\\.")
net.InstancesOf("win32_networkadapterconfiguration").each do |i|
if i.ipenabled == false
#puts "Interface Disabled"
else
puts i.ipaddress
puts i.defaultipgateway
puts i.macaddress
end
end