In this post, I will share a simple SQL query that lets you find the NetBIOS name, IP address and domain name information of devices within the SCCM collection.
In my previous organization, I worked on migration of Windows 10 devices to Windows 11 and during this project I had to find out few details of remote devices as a prerequisite. The information required before migration was the IP address of each device, along with the domain name and computer name.
Fortunately, this data can be effortlessly retrieved from the Configuration Manager database using a SQL query. All you require is the permissions to run the query and device collection ID. To retrieve only the domain name details of your devices, you can also utilize a CMPivot query.

SQL Query to Find NetBIOS Name, IP Address and Domain Name
Here is how to find NetBIOS name, IP address and domain name of devices in SCCM using a SQL query:
Launch the SQL Server Management studio (SSMS) and connect to database engine. Expand Databases and right-click SCCM database and select New Query. In the query window, paste and execute the below query.
SELECT DISTINCT SYS.Netbios_Name0, FCM.Domain, SYSIP.IP_Addresses0
FROM v_R_System SYS INNER JOIN v_FullCollectionMembership FCM
ON SYS.ResourceID = FCM.ResourceID
INNER JOIN v_RA_System_IPAddresses SYSIP
ON SYS.ResourceID = SYSIP.ResourceID
WHERE FCM.CollectionID = 'SMS00001'
ORDER BY SYS.Netbios_Name0The above query retrieves all resources in the All Systems collection (SMS00001) and displays the NetBIOS name, domain name, and associated IP addresses. If you have a different device collection, you can substitute the collection ID in the query and run it.
In the query output, the results are sorted by NetBIOS name. The query joins the v_R_System and v_RA_System_IPAddresses discovery views, and joins the v_FullCollectionMembership collection view by using the ResourceID column.

To export the above results, press Ctrl + A and right-click on the data and select save results as. Choose .csv or .txt file to save the details.



