Q:

How to parse a particular WMIobject driver as a string?

The objective of this is to get the display driver version from win32_PnPSignedDriver. I am stuck on how to filter it out.
I got some idea from How do I parse data from a Get-WMIObject query into a string? and modified it. However the output is displaying a whole list of driver version information but I just want one print out the display driver version.
Was wondering if there is a way using powershell? I have a code based written for powershell and it needs the display version to proceed.
my command i used was
get-wmiobject -class win32_PnPSignedDriver | select deviceclass -expand DriverVersion

Edited:
The expected output should be just the value if its intel graphics driver, eg: 10.18.15.4248
I need to parse this value to a variable and compare it with a known fixed value in verification script

A:

Create a collection of display drivers by filtering the WMI results based on DeviceClass. Select description and driver version from the filtered results. Like so,
# Get all drivers that have display as deviceclass
$ds = gwmi -class win32_PnPSignedDriver | ? { $_.DeviceClass -eq "DISPLAY" }

# Select description and driver's version
$ds | select description,driverversion

description                     driverversion
-----------                     -------------
NVIDIA Quadro P500              24.21.13.9836
Intel(R) UHD Graphics 620       25.20.100.6472

Edit: To get just the version string without any extra, process the results with a foreach aka % like so,
# An empty array for the results
$versions = @()

# Add each version as new array element
$ds | % { $versions += $_.driverversion }

# Print results
$versions
24.21.13.9836
25.20.100.6472

# Access the 1st element
$versions[0]
24.21.13.9836

# See the result type
$versions[0].gettype()

IsPublic IsSerial Name                                     BaseType
-------- -------- ----                                     --------
True     True     String                                   System.Object

