In this post I will show you how to delete mac address of device without opening SCCM console. Wbemtest is the inbuilt utility which can be used to browse the sms provider table which contains the information of all devices.
This is not the supported way to remove the device from SCCM, run at your own risk. However, this is the most convenient way to remove the device by providing Mac address info without opening Console.
wbemtest utility to get data you see SCCM console
Wbemtest stands for Windows Management Instrumentation Tester which helps us connecting to existing Namespace and class. As we know that Configuration Manager relies on SMS Provider to replicate the date from to and from Configuration manager to SCCM database.
SMS Provider itself consists of various tables and what you see on SCCM console, infact you are directly doing on Console is getting the information from SMS Provider. Once you make any changes on SCCM console, adding / deleting / modifying, the changes are made in SMS Provider tables such as sms_r_system and others and then those changes replicates back to SQL Database.
Hence, sms provider acts as a layer between Configuration Manager and SQL Database. If we make any changes in console, we are modifying SMS Provider tables and eventually syncing to Database.
Delete SCCM Device using Wbemtest
As we understand now how important is sms provider, we can directly interact with it by running query and deletion of objects without opening SCCM console.
For example, if you have to delete device from SCCM based upon specific Mac Address. First you need to search for the MAC address of the device in SCCM collection, then you have to delete the device.
The same thing can be done using wbemtest.
Let’s say you have to delete the device from All systems collections which is having MAC address of 00:15:5D:00:7F:44, we wanted to delete it without opening console.
Login to Configuration Manager server or any other server which can be used to connect to the WMI of the SCCM server.
Click on Start > Run and type wbemtest (inbuilt utility on windows Server & Workstation)
This will launch Windows Management Instrumentation Tester, click on Connect and provide following value under Namespace:
The format used is: root\sms\site_<sitecode>, if you are connecting through remote server then use \\SCCMServer\root\sms\site_<sitecode>
Once connected, we can see Namespace name displayed, under IWbem Services click on Query.
Window will open which require WQL Query to run which is somehow similar to SQL Query, Provide following query and click on Apply.
select * from sms_r_system where macaddresses = '00:15:5D:00:7F:44'
This has returned 1 object from the table sms_r_system with resourceId shown. Just select it and click on Delete
If you wanted to know the device info such as what is Hostname, operating System info of this specific device then simply double click the object, click on Show MOF which will display all instance of SMS_R_System related to this device.
Deleting the device by finding Mac Address or any the property value in WMI is the easiest way. This is not the supported way by Microsoft to play around with the data however I found it very useful as it simplifies the solution (only when you understand what you are doing).