March 1st, 2013

Use PowerShell to Explore Windows Audio Drivers

Doctor Scripto
Scripter

Summary: Microsoft Scripting Guy, Ed Wilson, talks about using Windows PowerShell to explore Windows audio drivers.

Hey, Scripting Guy! Question Hey, Scripting Guy! I have a problem with one of my computers—the audio driver is causing me fits. I would like to know if I can use Windows PowerShell to explore this issue. I think it would be really valuable, because I might have this issue come up again. Can you help me?

—DB

Hey, Scripting Guy! Answer Hello DB,

Microsoft Scripting Guy, Ed Wilson, is here. Hey, it is almost the weekend. In celebration of almost the weekend, I decided to get up early, fix a pot of Irish steel-cut oats, and a nice pot of English Breakfast tea. While the oats cooked, I used my Windows Surface to check my email. DB, this is when I ran across your email. Yes, Windows PowerShell can help in many different ways in looking at audio drivers.

First, find the audio device

The first thing to do is to find the audio device. To do this, use the WMI class Win32_SoundDevice WMI class. The Win32_SoundDevice WMI class tells me the device ID and the name of the audio device. The command is shown here.

 Get-CimInstance win32_sounddevice | fl *

 The command and its associated output are shown here.

 Image of command output

Next, find the driver 

Now that I know the name of the audio device, I can look for system drivers. To do this, I use the Win32_SystemDriver WMI class. I “cheap out” and pipe the results to the Where-Object. My resulting command is shown here. (gwmi is an alias for Get-WmiObject, ? is an alias for Where-Object, and fl is an alias for Format-List). 

gwmi win32_systemdriver | ? caption -match ‘conexant’ | fl * 

The command and its associated output are shown here.

Image of command output

Now get driver file info

Now that I have the path to the driver file, I can use the Get-Item cmdlet to retrieve version information. The first thing I need to do is to obtain the path to the driver. I can get this from the PathName property. I store it in a variable named $path. This is shown here. 

PS C:\> $path = (gwmi win32_systemdriver | ? caption -match ‘conexant’).pathname 

PS C:\> $path 

C:\WINDOWS\system32\drivers\CHDRT64.sys

Now I want to get only the VersionInfo property. To do this, I use the Get-Item cmdlet and return only VersionInfo as shown here.

PS C:\> (Get-Item $path).versioninfo 

 

ProductVersion   FileVersion      FileName 

————–   ———–      ——– 

8.32.43.0        8.32.43.0 bui… C:\WINDOWS\system32\drivers\CHDRT64.sys 

Hmm…

I know there is more information in this property, so I pipe it to the Format-List cmdlet as shown here.

(Get-Item $path).versioninfo | fl *

The commands and the associated output are shown here.

Image of command output

DB, that is all there is to using Windows PowerShell to look at audio driver information.  Join me tomorrow for the Weekend Scripter.

I invite you to follow me on Twitter and Facebook. If you have any questions, send email to me at scripter@microsoft.com, or post your questions on the Official Scripting Guys Forum. See you tomorrow. Until then, peace.

Ed Wilson, Microsoft Scripting Guy 

Author

The "Scripting Guys" is a historical title passed from scripter to scripter. The current revision has morphed into our good friend Doctor Scripto who has been with us since the very beginning.

0 comments

Discussion are closed.