I occasionally get a question where someone wants to report on some seemingly simple piece of client information which seems, initially, to be a “no-brainer.” Of course you can pull that information, just look, umm, I thought for sure that information was in here somewhere. There’s no possible way that it isn’t, I clearly must be overlooking it…..
Hmm, it’s not there. Then I think to myself, it must be Monday?!
So, I’ve learned over time that it’s not always the case – sometimes the seemingly most simple bits of information you want aren’t readily available for you out of the box.
So, what is a good example of this? The most recent one I ran into was a request to report on wireless network drivers and versions. I though for sure it would be included somewhere in Win32_NetworkAdapter or Win32_NetworkAdapterConfiguration or Win32_PnPEntity. Nope, it’s not there, maybe I’m missing it.
So my next question – where is it? I then came across a WMI Class called Win32_PNPSignedDriver. Well, that’s a very interesting WMI Class with lots of good information – including the information I’m looking for – however it contains way more than just network adapters, and to make matters worse, importing the pertinent information into my Configuration Manager 2012 Hardware Inventory didn’t collect anything from this Class no matter how hard I kicked it.
That’s when I came across a blog posting written by Vinay Pamnani, which helpfully pointed out a registry key which contains all the information I needed!
The registry key for network adapter driver information is at HKLM\SYSTEM\CurrentControlSet\Control\Class\{4D36E972-E325-11CE-BFC1-08002bE10318.
As Vinay’s blog posting was created back in Feb 2010, it was clear that it was for Configuration Manager 2007. Knowing this, it was time to take the information learned from his blog post and try it out in my trusty Configuration Manager 2012 R2 lab.
First, I (of course) made a backup copy of my configuration.mof in ConfigMgr\Inboxes\clifiles.src\hinv. I then copied the information from Vinay’s Configuration.mof snip (see below) into my clipboard and added a few more entries I found interesting:
[ dynamic,
provider("RegProv"),
ClassContext("local|HKEY_LOCAL_MACHINE\\SYSTEM\\CurrentControlSet\\Control\\Class\\{4D36E972-E325-11CE-BFC1-08002bE10318}")
]
class Win32Reg_NetworkDrivers
{
[key]
string Index;
[PropertyContext("DriverDesc")]
string DriverDesc;
[PropertyContext("DriverVersion")]
string DriverVersion;
[PropertyContext("DriverDate") ]
string DriverDate;
[PropertyContext("ProviderName")]
string ProviderName;
[PropertyContext("*MediaType") ]
string MediaType;
[PropertyContext("RemoteWakeEnable") ]
string RemoteWakeEnable;
[PropertyContext("*WakeOnMagicPacket") ]
string WakeOnMagicPacket;
};
provider("RegProv"),
ClassContext("local|HKEY_LOCAL_MACHINE\\SYSTEM\\CurrentControlSet\\Control\\Class\\{4D36E972-E325-11CE-BFC1-08002bE10318}")
]
class Win32Reg_NetworkDrivers
{
[key]
string Index;
[PropertyContext("DriverDesc")]
string DriverDesc;
[PropertyContext("DriverVersion")]
string DriverVersion;
[PropertyContext("DriverDate") ]
string DriverDate;
[PropertyContext("ProviderName")]
string ProviderName;
[PropertyContext("*MediaType") ]
string MediaType;
[PropertyContext("RemoteWakeEnable") ]
string RemoteWakeEnable;
[PropertyContext("*WakeOnMagicPacket") ]
string WakeOnMagicPacket;
};
Next, I pasted it into my configuration.mof on my CAS (yes, even at my own home there’s enough politics to cause me to have a CAS). Next, I simply pasted it between the section at the bottom in between “// Added extensions start” and “//Added extensions end” and saved it, so the final result looked like this:
This change provided my Configuration Manager hierarchy the knowledge about this registry key and all of the information of my interest within the key. Looking at this key, there are a plethora of other values to collect, but the only ones I added over and above Vinay’s example were: Provider, RemoteWakeEnable, and *WakeOnMagicPacket. If desired, I could’ve easily gathered additional information from this key such as the wireless roaming aggressiveness settings, whether or not the wireless radio is enabled, preferred wifi channel, PNP Device info – the list goes on.
Next, I copied the information for the SMS_DEF.MOF file, but once again, I added the additional information for ProviderName, RemoteWakeEnable, and WakeOnMagicPacket to let my ConfigMgr site know that I also want it to collect the information stored in these registry values during my client hardware inventories. All of this will be inserted into the new SQL View it will automatically create named “v_GS_NETWORK_DRIVERS”.
Here’s what I ended up with for my MOF to import into my Hardware Inventory:
#pragma namespace ("\\\\.\\root\\cimv2\\sms")
[ SMS_Report (TRUE),
SMS_Group_Name ("Network Drivers"),
SMS_Class_ID ("MICROSOFT|NETWORK_DRIVERS|1.0"),
Namespace ("\\\\\\\\localhost\\\\root\\\\cimv2") ]
class Win32Reg_NetworkDrivers : SMS_Class_Template
{
[SMS_Report (TRUE), key ]
string Index;
[SMS_Report (TRUE) ]
string DriverDesc;
[SMS_Report (TRUE) ]
string DriverVersion;
[SMS_Report (TRUE) ]
string DriverDate;
[SMS_Report (TRUE) ]
string MediaType;
[SMS_Report (TRUE) ]
string ProviderName;
[SMS_Report (TRUE) ]
string RemoteWakeEnable;
[SMS_Report (TRUE) ]
string WakeOnMagicPacket;
};
[ SMS_Report (TRUE),
SMS_Group_Name ("Network Drivers"),
SMS_Class_ID ("MICROSOFT|NETWORK_DRIVERS|1.0"),
Namespace ("\\\\\\\\localhost\\\\root\\\\cimv2") ]
class Win32Reg_NetworkDrivers : SMS_Class_Template
{
[SMS_Report (TRUE), key ]
string Index;
[SMS_Report (TRUE) ]
string DriverDesc;
[SMS_Report (TRUE) ]
string DriverVersion;
[SMS_Report (TRUE) ]
string DriverDate;
[SMS_Report (TRUE) ]
string MediaType;
[SMS_Report (TRUE) ]
string ProviderName;
[SMS_Report (TRUE) ]
string RemoteWakeEnable;
[SMS_Report (TRUE) ]
string WakeOnMagicPacket;
};
Knowing there’s no longer an SMS_DEF.MOF that exists in clifiles.src/hinv on ConfigMgr 2012, I instead pasted it into a new file I created in Notepad and named it something memorable but only slightly witty such as “wifidriversarefun.MOF”. I went to my Administration/Client Settings and modified my Default Client Settings on my CAS. Next, I drilled into the Hardware Inventory section of my Default Client Settings (note: you MUST select Default Client Settings) and clicked the “Set Classes” button:
Next, click “Import” and browse to the “wifidriversarefun.MOF” file you saved.
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.
I also left all of the class settings checked since I wanted everything that I defined in both my configuration.mof and my imported Hardware Inventory MOF, and clicked OK a couple times.
Next, go to Monitoring->Reporting->Reports and click “Create Report”
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”.
Once SQL Report Builder 3.0 appears, select “Table or Matrix”:
And then “Create a Dataset”. The “New Table or Matrix” wizard appears with your Data Source Connection to your ConfigMgr 12 database. Click the “Test Connection” to confirm all is well.
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:
Next, expand v_GS_NETWORK_DRIVERS and select the values that you want included in your report; first from v_GS_NETWORK_DRIVERS to get the new Network Adapter Driver information:
Then, select Name0 from the v_GS_System view so that you will also get a computer name included.
Click on “Auto Detect”, and then click the “Add Relationships” button to the right of “Edit Fields”
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.
Now, click the “Add Field” button:
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.
Now the final result should appear like this:
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”.
Uncheck the “Show subtotals and grand totals” and “Expand/collapse groups” checkboxes.
Select your favorite SSRS style:
Now you should have a nice report showing each of your network adapters and their pertinent driver information, as well as some additionally helpful wake-on-lan information. 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 only the wireless network adapters, under Datasets, right-click “DataSet1” and click “Properties”.
Then click “Filters” and click "Add” to add a filter:
In “Expression” field, select “MediaType0”. Leave the Operator at "=”, and the value of MediaType0 for all wireless adapters happens to be a value of “16”.
Save the report, run it again, and viola, only the wireless network adapters and their driver information will magically appear for each client, along with their driver dates, descriptions, versions and WakeOnLan settings.
Now, for an extra bonus, if you want to be able to click on any client and have it show you some additional Network Adapter information for a specific client, right click in the [Name0] cell, and click “Text Box Properties”
Click “Action” and in the “Change Action Options” section, select the “Go to report” radio button, click “Browse”, and browse to the Hardware – Network Adapter / “Network Adapter information for a specific computer” report. Under “Use these parameters to run the report”, click “Add”, select “variable” in the Name field, and “[Name0]” in the Value field, and click OK.
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!)
link from : https://blogs.technet.microsoft.com/configmgr_geek_speak/2013/11/10/inventorying-and-reporting-network-adapter-driver-details-and-how-to-report-only-the-wireless-type-with-bonus-mini-primer-on-sql-report-builder-in-configuration-manager-2012/
No comments:
Post a Comment