Post by mayayanaThat might work well, but I think there are at least
1) Win32_PnPSignedDriver is only available on XP+.
I didn't realize that when you first posted it, but when
I didn't find Win32_PnPSignedDriver in my WMI help
file I went looking. I'm on 98SE, so it's no good to me --
or to anyone on 2000/ME.
Yeah, you are right! U are from the US? Look here:
This is Bob Dylan, a great poet, composer and musician, and that are
Peter, Paul & Mary: ;-)
These were still times, they could still sing!
Post by mayayana2) I still question why one would want to be limited to
signed drivers when there are other methods to return driver
versions. It seems to be a situation similar to the installed
software functions of WMI: Microsoft unilaterally imposed a
standard, which they may or may not even follow themselves,
and then built it into WMI, pretending that it was universal.
That it is not exactly: The OP asked for "the driver version of all the
devices on my computer" and the WMI-Method delivers exactly such things.
He did not tell anything about the Windows version. The
Win32_PnPSignedDriver-method determines all plug-and-play device
drivers, no matter wether they are signed or not. The reason for
crashing the OS was earlier incompatible such drivers and often not the
OS, but all people thought that it did that.
Post by mayayanaTo explain: WMI installed software only lists programs
installed via MSI, which is a very tedious method that Microsoft
themselves often don't use. So the installed software functions
are pretty much useless because they don't report the majority of
software installed. And of what is reported, one can get more info.
by just going directly through WindowsInstaller.Installer. So the
WMI functions for that are just a useless wrapper. But MS wants
to pretend that MSI is the only way to install software, so they
had to make the WMI functions useless in order to "save face".
Sorry, I can understand that you are annoyed, but this is an other
problem that does not belongs to ours just now.
Post by mayayanaIn the same way, a lot of hardware companies didn't cooperate
with Microsoft's driver signing push at first. It may be that some
still don't. So listing only signed drivers would seem to be slightly
undependable at best.
No, the method Win32_PnPSignedDriver lists all device drivers. It
delivers only either they are signed or not. The method
Win32_SystemDriver is for *system* *drivers*, sometimes they are for
devices, sometimes they assist *some* devices. This is a little but
important difference! A system driver can offer services for different
devices at the same time, e.g. a file system driver, a device driver is
only for interacting with exactly defined hardware, e.g. hard disks or
graphics devices.
This is a script for System Drivers and it displayes the file version of
the driver if avaílable with *two* different methods:
'######################### SystemDriver.vbs ###########################
Option Explicit
' It is recommended to execute this script with CScript as host at the
' command prompt:
' CScript.exe <Path to Script>\SystemDriver.vbs
' CScript.exe C:\Windows\SystemDriver.vbs
Dim wmi, wmiInst, i, str
Set wmi = GetObject("winmgmts:root\cimv2")
For Each wmiInst In wmi.InstancesOf("Win32_SystemDriver")
With wmiInst
i = i + 1
WScript.Echo vbCRLF & "DisplayName: " & .DisplayName
WScript.Echo "Name: " & .Name
WScript.Echo "Started: " & .Started
WScript.Echo "StartMode: " & .StartMode
WScript.Echo "ServiceType: " & .ServiceType
WScript.Echo "State: " & .State
If Not(IsNull(.PathName)) Then
str = RemoveIllChar(.PathName)
WScript.Echo "PathName: " & str
WScript.Echo "File Version: " & GetVersion(str)
With CreateObject("Scripting.FileSystemObject")
WScript.Echo "FSO File Version: " & .GetFileVersion(str)
End With
End If
WScript.Echo "DesktopInteract: " & .DesktopInteract
WScript.Echo "AcceptPause: " & .AcceptPause
WScript.Echo "AcceptStop: " & .AcceptStop
WScript.Echo "ErrorControl: " & .ErrorControl
WScript.Echo "ExitCode: " & .ExitCode
WScript.Echo "ServiceSpecificExitCode: " & _
.ServiceSpecificExitCode
WScript.Echo "Status: " & .Status
WScript.Echo "TagId: " & .TagId
'WScript.Echo "SystemName: " & .SystemName
WScript.Echo String(72, "#")
End With
Next
WScript.Echo vbCRLF & i & " system drivers were found."
Function RemoveIllChar(strPfad)
Const ILL = "\??\"
If InStr(strPfad, ILL) > 0 Then
strPfad = Right(strPfad, Len(strPfad) - (InStr(strPfad, ILL) +_
Len(ILL) - 1))
End if
RemoveIllChar = strPfad
End Function
Function GetVersion(strPath)
Dim objFile
For Each objFile In wmi.ExecQuery("select * from CIM_Datafile" & _
" where Name = '" & Replace(strPath, "\", "\\") & "'")
GetVersion = objFile.Version
Next
End Function
--
ЯR