Module: Facter::Util::Macaddress::Windows

Defined in:
lib/facter/util/macaddress.rb

Instance Method Summary collapse

Instance Method Details

#macaddressObject



30
31
32
33
34
35
36
37
38
39
40
41
# File 'lib/facter/util/macaddress.rb', line 30

def macaddress
  require 'facter/util/wmi'

  query = "select MACAddress from Win32_NetworkAdapterConfiguration where IPEnabled = True"

  ether = nil
  Facter::Util::WMI.execquery(query).each do |nic|
    ether = nic.MacAddress
    break
  end
  ether
end