From: Daniel Berger Date: 2005-11-09T04:29:27+09:00 Subject: Re: Ruby with WMI but that is not the problem. happy-jack wrote: > Hey I am new to ruby and I do Windows administration. I have been > playing with wmi and ruby, having a problem. This is not a problem > with th wmi part but when I use get. I am asking for a computer name > and then putting that information into the script. This does not work > > [Start Code] > require 'win32ole' > > puts "what is the computer name that you want to use??? " > cpuName = gets Try STDIN.gets > cpuName.chomp Try cpuName.chomp! > mgmt = WIN32OLE.connect("winmgmts:\\\\#{cpuName}") > mgmt.InstancesOf("Win32_ComputerSystem") .each{ |item| puts item.name + > "\n" + item.Manufacturer + " - " + item.Model} > mgmt.InstancesOf("Win32_SystemEnclosure").each{ |dev| puts > dev.SerialNumber} > > [/End Code] Regards, Dan