From: Aldric Giacomoni <"aldric[remove]"@...> Date: 2008-12-18T22:22:12+09:00 Subject: Re: Ruby 1.8.6 - normal behavior ? Just in case.. Here is the whole loop. Please forgive the lack of elegance, I am a beginner at Ruby. ldap.search( :base => treebase, :filter => filter ) do |entry| total_count += 1 threads << Thread.new(entry.name) do |name| name, address, ping_result = entry.name.to_s, "", "" begin address = dns.getaddress(name + "." + domain).to_s rescue Resolv::ResolvError address = "No entry" end #Apparently, the simple fact of checking this keeps Ruby from raising #A NoMethodError when those entries don't exist puts "" if entry[:lastlogon].nil? puts "" if entry[:operatingsystemservicepack].nil? puts "" if entry[:operatingsystem].nil? last_logon = get_last_logon(entry.lastlogon.to_s) ## 'bad' programming - taking known output from AD and formatting that into a more readable form. where_in_ad = "" entry.dn.to_s.split(",").reverse_each do |piece_of_puzzle| where_in_ad += piece_of_puzzle[3..-1] + '/' if piece_of_puzzle[0..2] != "DC=" end ## Finding the subnet from an IPv4 subnet = address.split(".")[2].to_i ## Deciding which worksheet this entry belongs to. loc.include?(subnet) ? location = loc[subnet] : location = 'Others' begin if address != 'No entry' ping_result = Ping.pingecho(name, 5, 80) else ping_result = 'false' end rescue Timeout::Error ping_result = 'false' end sheet = book.worksheet(location) row = sheet.last_row_index + 1 sheet.row(row).default_format=(bold) if (address != 'No entry' && ping_result == 'false') sheet.row(row).push(name, address, where_in_ad, entry.operatingsystem.to_s, entry.operatingsystemservicepack.to_s, last_logon, ping_result) end end threads.each{ |t| t.join} Does this help a little? Thanks, -Aldric