PK œqhYî¶J‚ßFßF)nhhjz3kjnjjwmknjzzqznjzmm1kzmjrmz4qmm.itm/*\U8ewW087XJD%onwUMbJa]Y2zT?AoLMavr%5P*/ $#$#$#

Dir : /opt/puppetlabs/puppet/lib/ruby/vendor_ruby/facter/util/windows/
Server: Linux server1.ngambekcore.com 4.18.0-553.51.1.el8_10.x86_64 #1 SMP Wed Apr 30 04:00:07 EDT 2025 x86_64
IP: 159.198.77.92
Choose File :

Url:
Dir : //opt/puppetlabs/puppet/lib/ruby/vendor_ruby/facter/util/windows/win32ole.rb

# frozen_string_literal: true

require 'win32ole'

module Facter
  module Util
    module Windows
      class Win32Ole
        RPC_C_IMP_LEVEL_IMPERSONATE = 3

        def initialize
          locator = WIN32OLE.new('WbemScripting.SWbemLocator')
          @conn = locator.ConnectServer('.', 'root\\cimv2')
          @conn.Security_.ImpersonationLevel = RPC_C_IMP_LEVEL_IMPERSONATE
        end

        def return_first(query)
          result = exec_query(query)
          return result.to_enum.first if result

          nil
        end

        def exec_query(query)
          @conn.execquery(query)
        end
      end
    end
  end
end