rubyのwin32oleでディスク情報チェック
最近更新さぼっているので、とりあえずwin32oleでなんか書いておこう。
require 'win32ole' require 'pp' def diskinfo host = "." service = WIN32OLE.connect("winmgmts://#{host}/root/cimv2") disk = service.ExecQuery("Select * from Win32_LogicalDisk") hash = {} disk.each {|x| hash[x.DeviceID] = [x.FreeSpace, x.Size] } return hash end pp diskinfo