diff options
-rw-r--r-- | lib/facter/macaddress.rb | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/lib/facter/macaddress.rb b/lib/facter/macaddress.rb index 30d4b59..98e38b8 100644 --- a/lib/facter/macaddress.rb +++ b/lib/facter/macaddress.rb @@ -63,3 +63,17 @@ Facter.add(:macaddress) do ether[0] end end + +Facter.add(:macaddress) do + confine :kernel => %w(windows) + setcode do + ether = [] + output = %x{ipconfig /all} + output.split(/\r\n/).each do |str| + if str =~ /.*Physical Address.*: (\w{1,2}-\w{1,2}-\w{1,2}-\w{1,2}-\w{1,2}-\w{1,2})/ + ether.push($1.gsub(/-/, ":")) + end + end + ether[0] + end +end |