Sha256: 0724e39d831b5941a2e2ea45735c28edc27d5742f5e67bb0ff0e182dce4d2c58

Contents?: true

Size: 1020 Bytes

Versions: 4

Compression:

Stored size: 1020 Bytes

Contents

require 'facter/operatingsystem/base'

module Facter
  module Operatingsystem
    class Windows < Base
      def get_operatingsystemrelease
        require 'facter/util/wmi'
        result = nil
        Facter::Util::WMI.execquery("SELECT version, producttype FROM Win32_OperatingSystem").each do |os|
          result =
            case os.version
            when /^6\.2/
              os.producttype == 1 ? "8" : "2012"
            when /^6\.1/
              os.producttype == 1 ? "7" : "2008 R2"
            when /^6\.0/
              os.producttype == 1 ? "Vista" : "2008"
            when /^5\.2/
              if os.producttype == 1
                "XP"
              else
                begin
                  os.othertypedescription == "R2" ? "2003 R2" : "2003"
                rescue NoMethodError
                  "2003"
                end
              end
            else
              Facter[:kernelrelease].value
            end
          break
        end
        result
      end
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
facter-2.2.0 lib/facter/operatingsystem/windows.rb
facter-2.2.0-x86-mingw32 lib/facter/operatingsystem/windows.rb
facter-2.2.0-x64-mingw32 lib/facter/operatingsystem/windows.rb
facter-2.2.0-universal-darwin lib/facter/operatingsystem/windows.rb