Link to home
Start Free TrialLog in
Avatar of CHYRO
CHYRO

asked on

Store macAddresses in AD

Hi Folks,
How do I get AD to store macaddresses of all computers in a domain. It seems an obvious thing to do, and there is a macaddress attribute in the default schema, but it doesn't get populated. Do I have to somehow marry DHCP (which stores macaddresses) and AD ?
The reason I want to do this is I am using Veyon and want to be able to WOL a group of machines without having to manually gather all their macaddresses. Thanks in advance.
Avatar of kevinhsieh
kevinhsieh
Flag of United States of America image

Specops Gpupdate tool has WOL feature. It learns MAC addresses from the Windows DHCP.

Otherwise, you will need to programmatically get MAC addresses and save them in AD.
Avatar of CHYRO
CHYRO

ASKER

Ok, looks promising. Let me try it and I'll get back you. Thanks for now Kevin.
I just looked at my AD attributes and I am not seeing the MacAddress attribute.
What is the name of the attribute you are looking to update?
This is a bit rough, but it does populate the targeted attribute for the object.

$comps = Get-ADComputer -Filter * 
$Report=@()
Foreach ($comp in $comps)
{
 If (Test-Connection -computername $comp.name -Count 1 -quiet)
    {
            $mac = (Get-WmiObject win32_networkadapterconfiguration -ComputerName $comp.Name |? {$_.IpEnabled -Match "True"}).Macaddress
            $obj=new-object System.Object
            $obj |add-member -membertype NoteProperty -name "Name" -Value $comp.Name 
            $obj|add-member -membertype NoteProperty -name "MacAddress" -value $mac
            $Report+=$obj
       
       
        Set-ADComputer -Identity $comp.Name -add @{extensionAttribute1=$mac}
    }
}

$Report

Open in new window

Avatar of CHYRO

ASKER

Ok so I tried SpecOps GPUPdate Kevin, but it still doesn't get that MacAddresses in AD which is what I need to get Veyon working properly.

Hi yo_bee,
It appears that the mac address could be stored in a number of AD fields (HWAddress, PhysicalAddress), but routinely isn't, which to me is quite baffling, that something as important and useful as macAddresses are not kept by default in AD ..... so many programs like firewalls and anything with WOL functionality that integrate with AD cannot access this info.
Forgive my ignorance but what language is that script - what extension should I give it to run it ? Tried .vbs but didn't work.
Sorry I am not much of a AD guru. I am presuming I have to run this script on every client machine via a group policy ?
Thanks in Advance
Specops Gpupdate doesn't look in AD for MAC addresses. It looks at all your Windows DNS databases to find leases and reservations that match the computer name(s) you want to boot. It doesn't work with devices that are not using DHCP.
This question needs an answer!
Become an EE member today
7 DAY FREE TRIAL
Members can start a 7-Day Free trial then enjoy unlimited access to the platform.
View membership options
or
Learn why we charge membership fees
We get it - no one likes a content blocker. Take one extra minute and find out why we block content.