ahFeel
public ruby v1 · immutablerequire 'win32ole'require 'socket'host = Socket.gethostnamecs = "winmgmts://#{host}/root/cimv2"begin wmi = WIN32OLE.connect(cs)rescue WIN32OLERuntimeError => e raise "Unsupported Windows Version."else query = "select * from Win32_LogicalDisk" hd = wmi.InstancesOf("Win32_OperatingSystem") hd.each { |f| puts f.FreeSpace }end