def self.uname(host=Socket.gethostname)
cs = "winmgmts://#{host}/root/cimv2"
begin
wmi = WIN32OLE.connect(cs)
rescue WIN32OLERuntimeError => e
raise Error, e
else
query = "select * from Win32_OperatingSystem"
wmi.InstancesOf("Win32_OperatingSystem").each{ |os|
return UnameStruct.new(
os.BootDevice,
os.BuildNumber,
os.BuildType,
os.Caption,
os.CodeSet,
os.CountryCode,
os.CreationClassName,
os.CSCreationClassName,
os.CSDVersion,
os.CSName,
os.CurrentTimeZone,
os.Debug,
os.Description,
os.Distributed,
os.ForegroundApplicationBoost,
self.convert(os.FreePhysicalMemory),
self.convert(os.FreeSpaceInPagingFiles),
self.convert(os.FreeVirtualMemory),
self.parse_ms_date(os.InstallDate),
self.parse_ms_date(os.LastBootUpTime),
self.parse_ms_date(os.LocalDateTime),
os.Locale,
os.Manufacturer,
os.MaxNumberOfProcesses,
self.convert(os.MaxProcessMemorySize),
os.Name,
os.NumberOfLicensedUsers,
os.NumberOfProcesses,
os.NumberOfUsers,
os.Organization,
os.OSLanguage,
os.OSProductSuite,
os.OSType,
os.OtherTypeDescription,
os.PlusProductID,
os.PlusVersionNumber,
os.Primary,
os.QuantumLength,
os.QuantumType,
os.RegisteredUser,
os.SerialNumber,
os.ServicePackMajorVersion,
os.ServicePackMinorVersion,
self.convert(os.SizeStoredInPagingFiles),
os.Status,
os.SystemDevice,
os.SystemDirectory,
self.convert(os.TotalSwapSpaceSize),
self.convert(os.TotalVirtualMemorySize),
self.convert(os.TotalVisibleMemorySize),
os.Version,
os.WindowsDirectory
)
}
end
end