Hardware Inventory customization - only specific services

There's a particular MOF edit you could use to only report on specific services, and not pull back all services by changing FALSE to TRUE on the win32_service class in the default sms_def.mof.  Since Brian Mason, ConfigMgr MVP, indicated he wants to call out this mof edit at his MMS session, I'm blogging this edit.  I won't tell you why it's so cool--you are going to have to wait until Brian and Steve Thompson's session on Monday!

Below is a sample mof snippet to be added to sms_def.mof and configuration.mof (If you are SMS2003, add both to sms_def.mof or mini.mof, and use your normal mofcomp routine to tell your clients how to report).  This example would be if the only services you wanted to know about were the 1e services for Nomad, Nightwatchman, and their WakeupAgent.  But for an example, it may be that the only services you are interested in would be the firewall, and the services for your anti-malware or anti-spyware.

And special thanks to the Dude at Dudeworks.com, he provided the expertise to create this edit.  Thanks Dude!

//==================================================================
//      Add to SMS_DEF.MOF
//      Created by Dudeworks.com
//      REPORT : Win32_ServicesLTD
//==================================================================
#pragma deleteclass("Win32_ServicesLTD",NOFAIL)

[dynamic, provider("MS_VIEW_INSTANCE_PROVIDER"),
 SMS_Report(TRUE), SMS_Group_Name("Win32_ServicesLTD"),
 SMS_Class_ID("CUSTOM|Win32_ServicesLTD|1.0")]
class Win32_ServicesLTD : SMS_Class_Template
{
                [SMS_Report(TRUE)] String DisplayName;
                [SMS_Report(TRUE), key] String Name;
                [SMS_Report(TRUE)] String PathName;
                [SMS_Report(TRUE)] String ServiceType;
                [SMS_Report(TRUE)] String StartMode;
                [SMS_Report(TRUE)] String StartName;
                [SMS_Report(TRUE)] String State;
};

//--------------------------------------------
// Add to Configuration.mof if Configuration Manager 2007
// Created by dudeworks.com
// Win32_ServicesLTD
//--------------------------------------------
#pragma namespace("\\\\.\\root\\cimv2")

[Union, ViewSources{"select DisplayName,Name,PathName,ServiceType,StartMode,StartName,State from Win32_Service where Name='SMSNomadP2P' OR Name='NightWatchman50' OR Name='SMSWUAgent'"},ViewSpaces{"\\\\.\\root\\cimv2"}, dynamic,Provider("MS_VIEW_INSTANCE_PROVIDER")]

class Win32_ServicesLTD
{
    [PropertySources{"DisplayName"}]
    string    DisplayName;
    [PropertySources{"Name"},Key]
    string    Name;
    [PropertySources{"PathName"}]
    string    PathName;
    [PropertySources{"ServiceType"}]
    string    ServiceType;
    [PropertySources{"StartMode"}]
    string    StartMode;
    [PropertySources{"StartName"}]
    string    StartName;
    [PropertySources{"State"}]
    string    State;
};

PS: After Brian and Steve's presentation, I'll edit this blog and mention why it's so useful to use this instead of simply enabling the existing win32_services.

Edit:  ok, my promised edit about why this is so cool.  At the company Brian, John, Rob and I work for, there are about two hundred thousand clients.  About a year ago (before I started) during one of their normal hardware inventory reviews, it was determined that no one was using the v_gs_service view for any reports or advertisements based on collections.  At that time, sms_def.mof for win32_service was changed from TRUE to FALSE.  Within a few days, the database size went from 120GB to 80GB.  Holy Recovered Space, Batman!  For various reasons, we were asked to get back service information.  You might be able to guess that there was some slight resistence to increasing DB size by 30% just for 1 report, and that 1 report was really just for us, anyway.  Rob Olson (the Dude from Dudeworks) and I brainstormed and determined it was theoretically possible to just grab the services we cared about.  He put together the edit, and here we are.  Getting the data we want, and not bloating the database.

Published Saturday, April 25, 2009 12:20 PM by skissinger
Filed under:

Comments

# re: Hardware Inventory customization - only specific services

I hope to be able to test the reverse logic I asked about at MMS.... log all the services EXCEPT a list of knowns.  This way we'll catch all the weird stuff and the DB shouldn't grow too much.

Thanks for the presentation!

Monday, May 04, 2009 5:43 PM by theChad