Inventorying and Reporting Scanners, Digital Cameras, and Webcams connected to Configuration Manager 2012 Clients

 

Similar to one of my past blog posts on how to go about collecting network adapter driver information including which are wireless versus wired adapters, you can also collect things like Scanners, Digital Cameras, and WebCams which are attached to your clients.

The registry key for these “Imaging Devices” is located in the registry at HKLM\SYSTEM\CurrentControlSet\Control\Class\{6bdd1fc6-810f-11d0-bec7-08002be2092f}  

If you take a look at this MSDN page for STI_DEVICE_TYPE Enumeration, you’ll learn that for the DeviceType registry value,

Scanner         = 1
DigitalCamera   = 2
StreamingVideo  = 3

For the value SubClass, “StillImage” is also a value that exists for Digital Cameras and Scanners as they are obviously still image creation devices.

Now – let’s get on with the fun!

Make a backup of your current configuration.mof in your \Inboxes\clifiles.src\hinv, and copy and paste the information from the configuration.mof snip to your Configuration.mof in (see below):

[ dynamic,
  provider("RegProv"),
  ClassContext("local|HKEY_LOCAL_MACHINE\\SYSTEM\\CurrentControlSet\\Control\\Class\\{6bdd1fc6-810f-11d0-bec7-08002be2092f}")
]
class Win32Reg_ImagingDevices
{
    [key]
        string    Index;
    [PropertyContext("DeviceType")]
        uint32 DeviceType; 
    [PropertyContext("DriverDesc")]
        string    DriverDesc;
    [PropertyContext("DriverVersion")]
        string    DriverVersion;
    [PropertyContext("DriverDate")  ]
        string    DriverDate;
    [PropertyContext("ProviderName")]
        string    ProviderName;
    [PropertyContext("SubClass")  ]
        string    SubClass;
};

Paste it into configuration.mof on your site server between the section at the bottom in between “// Added extensions start” and “//Added extensions end” and save it, so the final result looked like this:

image

Next, enter the information from the snip below into a somefilename.MOF for importing into your hardware inventory section of Administration/Client Settings.  All of this will be inserted into the new SQL View it will automatically create named “v_GS_IMAGING_DEVICES”.

#pragma namespace ("\\\\.\\root\\cimv2\\sms")
 
  [ SMS_Report     (TRUE),
  SMS_Group_Name ("Imaging Devices"),
  SMS_Class_ID   ("MICROSOFT|IMAGING_DEVICES|1.0"),
  Namespace      ("\\\\\\\\localhost\\\\root\\\\cimv2") ]
 
  class Win32Reg_ImagingDevices : SMS_Class_Template
  {
    [SMS_Report (TRUE), key ]
        string Index;
    [SMS_Report (TRUE)      ]
        uint32 DeviceType;
    [SMS_Report (TRUE)      ]
        string DriverDesc;
    [SMS_Report (TRUE)      ]
        string DriverVersion;
    [SMS_Report (TRUE)      ]
        string DriverDate;
    [SMS_Report (TRUE)      ]
        string ProviderName;
    [SMS_Report (TRUE)      ]
        string SubClass;
  };

Here’s what the .MOF you’ll import into client settings should end up looking like:

image

Go to Administration/Client Settings and modify Default Client Settings on your top-level site server.  Drill into the Hardware Inventory, and click “Set Classes”:

image_thumb5

Next, click “Import” and browse to the .MOF file you saved.

image_thumb11

Leave the “Import Summary” option at the default of “Import both hardware inventory classes and hardware inventory class settings”.  Once again click the “Import” button.

image_thumb3

Select which classes you want to collect, and click OK a couple times.

image_thumb1

Now, initiate a machine policy retrieval and a hardware inventory on a client or two which has a Scanner or other imaging device connected so the database gets populated with the new SQL view.  You can confirm the view exists by running a select * from v_GS_Imaging_Devices in SQL Management studio to confirm that you can proceed with creating the report.

Next, go to Monitoring->Reporting->Reports and click “Create Report”

image_thumb77

The “Create Report Wizard” will appear.  Select “SQL-based Report”, give it a memorable name, and select which folder on your SSRS you want to store it in.  Click “Next", “Next”, “Close”.

image

Once SQL Report Builder appears, select “Table or Matrix”:

image136_thumb

And then “Create a Dataset”.  The “New Table or Matrix” wizard appears with your Data Source Connection to your ConfigMgr database.  Click the “Test Connection” if you want to confirm all is well.

image_thumb64

If you don’t have the required permissions with your currently logged on account, instead of using your currently logged on credentials, type in the login credentials for an account which has the appropriate permissions to the site database, and click “Next”.

In the “Design a query” wizard, expand dbo –>Views:

image_thumb66

Next, expand v_GS_IMAGING_DEVICES and select the values that you want included in your report.  I recommend at a minimum ResourceID, DriverDate0, DriverDesc0, DriverVersion0, ProviderName0, SubClass0, and DeviceType0.  These will be listed in v_GS_IMAGING_DEVICES which is our Imaging Device information:

image_thumb33

Then, select Name0 from the v_GS_System view so that you will also get a computer name included.

image_thumb68

Click on “Auto Detect”, and then click the “Add Relationships” button to the right of “Edit Fields”

image_thumb69

Single click into the “Left Table”, selecting one of the two tables, then single click into the “Right Table”, and of course select the other view.  Your join can be Inner, Left Outer, Right Outer, or Full Outer, but I’m not going to go into depth on SQL joins today, so you can read more about them here.

image_thumb14

Now, click the “Add Field” button:

image_thumb16

Under the “Left Join Field”, select “ResourceID”.  Then under the “Right Join Field” column, once again select “ResourceID”.  ResourceID is the field which you should always be familiar with as pretty much every report that contains information about clients has a unique ResourceID value which identifies each client and allows you to join the various views together for reporting purposes.

image_thumb12

Now the final result should look like the image below:

image_thumb31

If all is well, click “Next” to continue, and on the “Arrange fields” step, drag “Name0” to the “Row groups” box, and the rest of the information you want associated with each computer name to the “Values” box” and click “Next”.

image_thumb20

Uncheck the “Show subtotals and grand totals” and “Expand/collapse groups” checkboxes.

image_thumb30

Select your favorite style, click Finish, and after your clients run their next hardware inventory, you should have a report showing each of your scanners, digital cameras, and webcams and their pertinent driver information, manufacturer, etc.  You can also customize the column names to something more meaningful as I have below (ie. Name0 –> Computer Name):

Now, if you want to filter it down to something like only the scanners, under Datasets,  right-click “DataSet1” and click “Properties”.

image_thumb24

Then click “Filters” and click "Add” to add a filter:

image_thumb71

In “Expression” field, select “[DeviceType0]”.  Leave the Operator at "=”, and the value for all Scanners is “1”.

image

Save the report, run it again, and viola, only the scanners will appear for each client, along with their driver dates, descriptions, and versions.

image_thumb29

Now, run the report and pat yourself on the back for making it to the end of this blog post (and hopefully you even have a working report!)