This article will explain how to create SCCM MAC address query to get device name from MAC Address. You can create WQL Query in SCCM to find computer name using MAC Address.
Finding the MAC address of a computer in SCCM is easy but if you want to get computer name from MAC address, you will need a custom query for that. Thankfully, the query is available, and you just need to know how to create and use it.
A MAC address is a unique identifier assigned to a network interface controller (NIC). It is a 12-digit hexadecimal number mostly represented by Colon-Hexadecimal notation.
There is no built-in WQL query present in SCCM to get the device name from the MAC address. However, you can create a custom WQL query to find the device name using the Mac address that you input.
When you install SCCM, it comes with default 18 WQL queries that you can use to locate devices in a Configuration Manager hierarchy that matches your query criteria. In this article, we will be using SCCM to query the ConfigMgr database to find clients with duplicate MAC addresses.
PXE Issues with Duplicate MAC Addresses
Finding the device name from Mac address is useful during PXE troubleshooting. Devices such as Surface Pro 3, dell tablets don’t have Ethernet ports, and you have to use a USB to Ethernet adapter for imaging.
The problem is that MAC Addresses are unique identifiers of network interfaces, but when you use the same USB to Ethernet adapter for multiple deployments, that’s where the PXE issues arise. SCCM thinks that it’s the same device and your device doesn’t receive the Task Sequence deployment.
Whenever there are devices with duplicate mac addresses, the PXE boot will not work fine. In such situations, you can find out the device name using MAC address with help of a simple query. FYI, SCCM can handle duplicate MAC address with SCCM duplicate hardware identifiers setting.
Ways to Find MAC address of Computers in SCCM
There are different ways to get the MAC address of devices in SCCM:
- WQL Query – You can create a WQL query in SCCM to find the device name using the MAC address.
- SQL Query – There are SQL queries available that can tell you the device name when you input MAC address. SQL query should be used to find computers with the duplicate MAC addresses. The results are fetched directly from the Configuration Manager database.
Out of the above methods, the WQL query method is easy and will save your time. That’s because you create the query once, and you can run it whenever required. Whereas with SQL query, you would need to run the query against the ConfigMgr database every time you need to find the device name from MAC address.
How to Find MAC Address of Device in SCCM Console
The Configuration Manager console has a dedicated column called “MAC Address” for displaying the MAC address of every device. This option is not enabled by default and can be enabled with few easy steps.
In Configuration Manager, you can find the MAC address of any device with following steps:
- Launch the SCCM console.
- Navigate to Assets and Compliance\Overview\Devices.
- Right-click on the toolbar and select MAC Address.
The MAC Address column shows the MAC address of each computer along with the name. If the device is not installed with SCCM client agent, you will not find the MAC address recorded for that device.
Create SCCM MAC Address Query
Alright, so let’s see the steps to create a new SCCM WQL query that will help us find the device name using MAC address. To create a new query in SCCM, go to Monitoring\Overview\Queries. Right-click Queries and select Create Query.
On the General page of Create Query Wizard, enter the Name of the query, comments and choose the Limiting Collection. If you select the option Prompt for collection, you will be asked to choose the device collection every time you run the query.
Click Edit Query Statement which will allow us to input the WQL query in the next step.
Select Show Query Language to enter or edit the query directly in WMI Query Language (WQL). In the Query language window, enter the below query and click OK.
The below WQL query is super useful to find the device name from MAC address.
SELECT SMS_R_System.Name, SMS_R_System.MACAddresses FROM SMS_R_System WHERE SMS_R_System.MACAddresses = ##PRM:SMS_R_System.MACAddresses##
Note: In the above query, PRM: ## will prompt the user to enter information (MAC Address), the message prompt and data type will match that of the field you have targeted.
On the Summary page, review the settings and click Next.
On the Completion window, click Close. This completes the steps to create MAC Address query in SCCM. In the next section, I will show you how to run this query.
SCCM Query to Find Device Name using MAC Address
In the above step, we created the SCCM MAC address query. We will now test this query by entering the MAC address of a device and check whether it resolves to correct computer name or not.
In the Configuration Manager console, go to Monitoring\Overview\Queries. Right-click the SCCM query “Find Device Name using MAC Address” and select Run.
In the Input query value window, you must enter the MAC address of the device. Enter the MAC address of the device and click OK.
The WQL query now returns the device name along with MAC address. If there are devices with same MAC addresses, you can use this query and eliminate the faulty ones.