I've done quite a bit of hardware inventory modifications in my time and while it's great to see the new information displayed in Resource Explorer, it has always kind of bothered me that the new classes always had the default icon while some of the other inventoried information had more descriptive, and lets face it, cooler looking icons. As I implemented more and more hardware inventory modifications, it also became a challenge for me to remember just how I pulled that information—was it a registry key, a NOIDMIF, a script…you get the idea. Wouldn't it be nice to have a custom icon to remind me where that data came from I thought. This issue would crop up every now and then which sent me on a wild goose chase looking around for a while on the net. I never really came across anything very helpful and eventually I'd move on to something else. While this is seemingly very minor issue, it has always bothered me that I couldn't figure it out. And then one fatefully day recently someone on the myITforum SMS e-mail list (subscribe here) had a problem that caused the non-default SMS 2003 Resource Explorer icons to revert to the standard default icons. Now my quest to change Resource Explorer icons had taken on new life, and actually had a basis in something useful in helping out someone, so it wasn't just a matter of me trying to do something cool in figuring this out.
Important: Before reading on, understand that the information in this post is in no way supported by Microsoft (or by me in general for that matter) and should only be used at your own risk. If you're not comfortable mucking about with the steps in this procedure and performing icon disaster recovery in the event something goes wonky, please do not attempt! If your icons are not broken and you aren't after the cool icon effects for whatever reason then it's probably not worth the risk.
Disclaimer out of the way, here's the good stuff. To understand how SMS 2003 decides which icon to display for hardware inventory information displayed in Resource Explorer, you need to have a clear understanding of the three pieces of this puzzle: the sms_res1.dll file, the sms_schm.mof file, and how this information is stored in WMI on the site server.
- The sms_res1.dll file contains all of the icons that can be displayed by default, and is located in the <install drive>:\SMS\bin\i386 directory. This file contains around 300 icons and some other assorted information that I'm not going to talk about here because it's just not relevant. If you open up the .dll in Visual Studio you'll see something like the below snippet, and if you then expand the icon node, you'll see the list of icons that it is possible to pick and choose from when using a standard icon:

The sms_schm.mof file is used to map each of the hardware inventory classes displayed in Resource Explorer to a specific icon stored within the sms_res1.dll file. It also lives in the <install drive>:\SMS\bin\i386 directory. Here you can see the part of the file where the CD-ROM information is assigned icon #316 in the SMS_RES1.dll file:

- The sms_schm.mof file stores mapped icon information for inventory classes in the IconDLL and IconID qualifiers for their respective WMI namespaces under root\sms\site_<site code> when it is compiled. You can see in the snippet below that the CD-ROM class is set to display icon #316 (the CD-ROM icon) in WMI and as stored in the SMS_RES1.dll file:

If you're looking in SMS 2003's Resource Explorer and see only the default icon for everything, then one of those three pieces has gone catawompus. To find the culprit, you can run a cursory visual check of the files to see if something has become corrupted. If it all looks OK, then back up all of these files to somewhere safe and recompile the sms_schm.mof file by opening up a command prompt, navigating to the directory that sms_schm.mof is located and then running this command: MOFCOMP sms_schm.mof. Restart the computer and Resource Explorer should be back to displaying the default, 'non-default' icons for those classes lucky enough to have been assigned one. If it isn't, then you might need to grab another copy of the sms_schm.mof file and/or sms_res1.dll file from the installation source files and try again. If that doesn't work, then your WMI might be corrupt or some other issue beyond the abilities of a blog post to help you and you need to burn a support call.
That issue resolved and out of the way, I decided that I would continue on my quest for custom icons in Resource Explorer. If all of the Resource Explorer icons are stored in the sms_res1.dll file and are called by the sms_schm.mof file then what's to stop me from changing a default icon to one of the other icons stored in the sms_res1.dll file? For that matter, what's to stop me from adding my own custom icons? Turns out, nothing lucky enough for me.
First things first, you need to find the icon that you want to use and it's associated IconID as listed in sms_res1.dll. To do this, you'll need to use Visual Studio to pop open the sms_res1.dll file and then poke around until you see an icon that you like. Take the icon's IconID (the number of the icon in the .dll), change the appropriate class IconID value in the sms_schm.mof file accordingly, and then recompile it.
That's great for pre-existing inventory classes, but what if you want to change the icon for a custom inventory class? No problem, just open up the sms_schm.mof file and add in a section at the bottom for your class. Below is the addition I made for the custom physical memory MOF edit to my sms_schm.mof file and you can use it as a template, just ensure the group name and class information matches your custom MOF edit:
[
SMS_Group_Name("Physical Memory"),
IconID(306),IconDLL("SMS_RES1.dll"),
SMS_Class_ID("MICROSOFT|PHYSICAL_MEMORY|1.0")]
Class Win32_PhysicalMemory : SMS_Class_Template
{};
Having the custom physical memory class information displayed using one of the default icons is OK, but wouldn't it be nice to have the icon actually look like RAM? Easy enough, just add the snippet above for the class to the sms_schm.mof file and change the class IconID property to display the RAM icon as stored in sms_res1.dll (IconID: 306). Recompile the sms_schm.mof file on the site server and hopefully the icons change the next time you open or refresh Resource Explorer. If not, restart the server and then here's what you should see in Resource Explorer (before and after):
Before:
After: 
Cool eh?
Using one of the predefined icons is handy, but if you don't see an icon that you like stored in sms_res1.dll, or you want to add your own custom icon for whatever reason, that's easy to do too. Using Visual Studio again, open up the sms_res1.dll file and add the icon of your choice to the file and save it. To do that, open the .dll in Visual Studio, right-click the Icon node, select Add Resource, ensure Icon is selected and then click Import. Browse to your favorite icon file and click open to add it. The new icon will appear in the list with an assigned ID and be highlighted in a box so you know which one you just added (remember the new IconID number!).
Next, make the appropriate changes to the sms_schm.mof file and compile it (MOFCOMP <path>\sms_schm.mof). Custom icons allow you to verify which classes are custom MOF edits and/or know where the custom class information came from depending on which icon you've decided upon for specific MOF editing techniques (registry, WMI, script, etc…). For example, this one came from a registry key:

Oops. That's not a registry icon (and didn't come from the registry either, but I'm using some poetic license here)! The registry icon is a default icon in the sms_res1.dll and wasn't very interesting to me, while Bill the Cat is one of my personal hero's. OK, kind of off-topic there, but it shows how you can use any icon that you want to and besides, couldn't the world use more Bill the Cat?
If you'd like to make an icon change, but don't want to permanently modify the sms_schm.mof file, then you can just go directly into WMI for that class and change the IconID to something more to your liking. If a class doesn't have the IconDLL or IconID qualifiers (both are required), just add them, but remember that recompiling the default sms_schm.mof file will result in the class displaying its original icon in Resource Explorer. Also know that at the top of the sms_schm.mof file is the #pragma autorecover command. That means if WMI is rebuilt on the site server for whatever reason, and you haven't made your changes in that mof file, the icons will all revert back to their installation defaults when the sms_schm.mof file is recovered.
So, there you go, mystery solved—for SMS 2003 sites. Don't even think about trying to use this post as a guide to change Resource Explorer icons for a Configuration Manager 2007 site as the process isn't exactly the same, but don't worry; I've got you covered on how to do that in another blog post that's coming soon.
~Jeff