Click here to monitor SSC
SQLServerCentral is supported by Red Gate Software Ltd.
 
Log in  ::  Register  ::  Not logged in
 
 
 

Retrieving Driver Information

4627390006_bd06dd71c8_mRecently, I had a need to take a look at all of the drivers for a specific set hardware on a server.  Long story short, I had to check the drivers on a half dozen network cards to verify that they were accurate and up to date.  There was a slight problem with this, though, to do so, it required an awful lot of clicking and making sure I got each one.

If you haven’t had the need before, when checking a driver, you’ll often head over to the Device Manager.  From there drill into the item that you need and check the driver status, shown in Figure 1.  Easy to do if there is only a single item, but a bit more challenging with two, or four, or eight.  As the number of items increases, there is a greater and greater chance of double checking or skipping over an item.

image
Figure 1 – Device Manager with Driver Properties

To avoid mistakes in the process, I turned to PowerShell.  Which, it turns out, provides an excellent way to dig into the system information with Get-WmiObject and by accessing the win32_pnpsigneddriver.

As an example of how you can use PowerShell to retrieve driver information, you can use it to look for specific items.  Using the script in Listing 1, you can search for all of the devices that were manufactured by a specific company.  In this case, searching for Atheros returned the results in Figure 2.


#Listing 1 – Equality Search

Get-WmiObject win32_pnpsigneddriver | WHERE {
$_.Manufacturer -eq "Atheros"
} | select Description , Manufacturer, driverdate, driverversion, signer

image
Figure 2 – Equality Search Results

Alternatively, you may need to retrieve driver information for a set of common but not exact items.  In that case, you may want to look for items that contain certain values.  The example in Listing 2 searches the devices for all of those that contain the word “ethernet” in their description.  The results in Figure 3 show that there are three devices on my laptop and the driver information with those items.


#Listing 2 – Equality Search

Get-WmiObject win32_pnpsigneddriver | WHERE {
$_.Description -like "*ethernet*"
} | select Description , Manufacturer, driverdate, driverversion, signer

image
Figure 3 – Like Search Results

As you can see, with just a little code, you can retrieve quite a bit of information and know that you have all of the information without accidentally missing one device or more.  If you haven’t started looking at using PowerShell to automate and bulletproof your tasks, it’s about time that you take a look at it.  Tasks such as verifying driver details may seem simple through the GUI but the ability to be more accurate and confident in the results through PowerShell makes a compelling case.


Follow me on Twitter at StrateSQL.

Original article: Retrieving Driver Information

©2012 Strate SQL. All Rights Reserved.

Related posts:

  1. Lost in Translation – Deprecated System Tables – sysdevices
  2. December PASSMN Meeting This Week
  3. December PASSMN Meeting Today

Comments

Leave a comment on the original post [www.jasonstrate.com, opens in a new window]

Loading comments...