> ## Content Index
> Fetch the complete content index at: https://www.archy.net/llms.txt
> Use this file to discover other available public pages before exploring further.

# SCCM - Find Devices MAC Address
- URL: https://www.archy.net/sccm-find-devices-mac-address/
- Published: 2017-08-25T13:56:16.000Z
- Updated: 2021-12-03T09:32:16.000Z
- Author: Stephane Thirion
- Tags: #wordpress, #rherpeux, #Import 2023-04-03 18:52, #Import 2023-04-18 08:20, #Import 2024-03-27 13:12

Hello Folks,

This week I needed to export from SCCM, the devices name and MAC Address to a CSV file.

I need this file to create green list into DHCP server. The Green list give permission to have a lease from DHCP server. I will speak of this subject in a futur post.

To find informations on devices into SCCM, we can work with WMI Class of SCCM. This script is based on WMI request.

| [Source code](#codesyntax%5F97 "Click to show/hide code block") | [![](https://i0.wp.com/www.archy.net/wp-content/plugins/wp-synhighlight/themes/default/images/code.png?w=1160&ssl=1)](#codesyntax%5F97 "Show code only") [![](https://i0.wp.com/www.archy.net/wp-content/plugins/wp-synhighlight/themes/default/images/printer.png?w=1160&ssl=1)](#codesyntax%5F97 "Print code") [![](https://i0.wp.com/www.archy.net/wp-content/plugins/wp-synhighlight/themes/default/images/info.gif?w=1160&ssl=1)](https://www.archy.net/wp-content/plugins/wp-synhighlight/About.html "Show plugin information") |
| --------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |

$SiteName = "FR1"
$ServerSite = "sccm"
$Mycoll = @()
foreach ($obj in (Get-WmiObject -Class SMS_R_SYSTEM -Namespace "rootsmssite_$SiteName" -computerName $ServerSite)) {
Write-Host $obj.NetbiosName $obj.MACAddresses $obj.OperatingSystemNameandVersion
$Mydetails = "" | Select-Object PCName, MacAddress, OS
If ($([String]$obj.MACAddresses) -eq "") {
$Mydetails.PCName = $obj.NetbiosName
$Mydetails.MacAddress = "Nul"
$Mydetails.OS = $obj.OperatingSystemNameandVersion
}
Else {
$Mydetails.PCName = $obj.NetbiosName
$Mydetails.MacAddress = [String]$obj.MACAddresses
$Mydetails.OS = $obj.OperatingSystemNameandVersion
}
$Mycoll += $Mydetails
}
$Mycoll | Out-GridView