SCCM/ConfigMgr is a very powerful tool. With a bit of work, you can extend SCCM to inventory just about anything including a Tesla. Why would I inventory a Tesla? There are a couple of answers to this question. First and foremost, I was working on a project that required a SCCM inventory extension. Since my proof of concept (POC) needed an external source to inventory, why not use my Tesla? The second reason for doing this was simply, “Why not?” It seemed like a cool thing to do. 😊 In this blog post, I am building on my previous post, How to Query a Tesla with PowerShell, so I am using that post as my starting point.
It is important to note that once you extend SCCM’s inventory using Data Discovery Records (DDR) you cannot reverse the process. There is currently NO method to undo it. Yes, there is a UserVoice Item to change this, so I encourage everyone to vote for it. Please understand, however, that until this is fixed, you cannot reverse the process if you inventory a Tesla or extend SCCM’s inventory using DDR on anything else.
This may sound ominous, and to a certain extent it is, BUT if you do this and you no longer want the results, IMO, it is not the end of the world. Depending on which DDR type (more on that later) the worst thing that happens is that you permanently see extra columns for all of your computer records in the console.
Keep in mind that what I’m showing you is fully supported by the Microsoft product team because everything listed here uses the Configuration Manager Software Development Kit (SDK). For more details about the SDK, please see the Configuration Manager SDK docs.
Use SCCM to Inventory a Tesla
This section should actually be called, “DDR Types.” Here, I am going to show you what you see when you inventory a Tesla with SCCM. These are the two types of DDRs I used when extending SCCM to inventory a Tesla: System and Custom. Below I explain more about each one.
This DDR type adds properties to a device within SCCM. The results can be seen within the console. With this information you can then create collections and reports. Why did I use this DDR type? I used it because I needed the inventoried data to be associated with a computer.
In the above screenshot, you see what was added to SCCM. Using the PowerShell script found in my previous post, everything between the two arrows was added.
IMO, I would avoid using this type of DDR because when you no longer need this information, the extra columns for all computer records cannot be deleted. On the other hand, if all of these columns are, “null,” does it really matter?
As the name implies this is a made-to-order DDR. Unfortunately, I found no useful way to have the collected details show-up within the console, BUT my reports worked well with this DDR type.
Unlike the System DDR, you don’t have to worry about seeing extra columns for your computer records in the console, but you are left with all of the custom “tables” in the SCCM database. There is no data left in the tables, so if everything is, “null,” and nothing exists within the console, does it matter? That’s why I prefer this DDR type. Only you, however, can decide whether this is suitable for your company.
As you can see in the above screenshot, you can query the custom results in the ConfigMgr console, but using reporting is the way to go if you want to make sense of these details.
These two SQL Server queries, shown in the above screenshot, work great for displaying the results of the custom DDRs in SSMS. With these results, you can go ahead and create Power BI and SSRS reports based on this data.
Users and Groups
Can you create custom attributes for Users and Groups within SCCM using DDRs? I haven’t tried, but I’m sure that you can.
DDR and PowerShell
Now I am going to tell you how to use SCCM to inventory a Tesla.
- First, review the PowerShell script that I used to inventory a Tesla Model 3 with SCCM.
- Place the Microsoft.ConfigurationManagement.Messaging.dll on the computer running the script.
- Understand that the DDRs, by default, are placed within a folder on the desktop and not within the DDM.box folder. For my testing, I manually copied the DDRs to the DDM.box folder.
- Update the username and password for your Tesla account.
At the end of the day, this exercise helped me a lot with the POC that I was working on. I can now hand it off to our Lead Developer’s team who gets to take it to the next level. Watch out for some interesting product releases from Enhansoft in the coming months based on this research!
How would you use the DDR feature? What other cars can you inventory with SCCM and PowerShell? GM cars perhaps? If you have any questions about how to use SCCM to inventory a Tesla or anything else, please feel free to touch base with me @GarthMJ.