Mar 20 2024 04:56 PM
I am after the Powershell Commands to retrieve the ethernet MACs of enrolled devices in Intune.
The aim is to create a script that pulls the MAC addresses for all enrolled devices at once.
Any help would be appreciated.
Mar 20 2024 07:53 PM
Mar 23 2024 11:10 PM - edited Mar 23 2024 11:11 PM
Hi,
unfortunately the standard output of Get-MgDeviceManagementManagedDevice does not contain the EthernetMacAddress, only the WiFiMacAddress. so you have to call the device again separately here is a script
$allIntuneDevices = Get-MgDeviceManagementManagedDevice -All
$outputFilePath = "C:\temp\IntuneDevices.txt"
foreach ($intuneDevice in $allIntuneDevices) {
$singelDevice = Get-MgDeviceManagementManagedDevice -ManagedDeviceId $intuneDevice.ID | Select DeviceName, EthernetMacAddress, OperatingSystem
$singelDevice | Export-Csv -Path IntuneDevices.csv -Delimiter ";" -Encoding utf8 -IncludeTypeInformation -Append
#or in your format
$output = "Device: $($singelDevice.DeviceName)
Operating System: $($singelDevice.OperatingSystem)
Ethernet MAC: $($singelDevice.WiFiMacAddress)"
Write-Output $output
$output | Out-File -FilePath $outputFilePath -Append
}
Jun 06 2024 01:27 PM