I'm trying to to pull driver information from all the computers across our network but am having an issue where some throw an error. The command I'm running is this:
Get-CimInstance Win32_PnPSignedDriver | Where-Object DeviceName -eq "drivername" | Select-Object DriverVersion
And the error some computers throw is this:
Get-CimInstance Win32_PnPSignedDriver | Where-Object DeviceName -eq " ...
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
CategoryInfo : NotSpecified: (root\cimv2:Win32_PnPSignedDriver:String) [Get-CimInstance], CimException
FullyQualifiedErrorId : HRESULT 0x800706be,Microsoft.Management.Infrastructure.CimCmdlets.GetCimInstanceCommand
Even if I simplify the command down to Get-CimInstance Win32_PnpSignedDriver I still get the same error. The following commands work just fine:
Get-CimInstance Win32_ComputerSystem
Get-CimInstance Win32_Process
Get-CimInstance CIM_LogicalDevice
Get-WmiObject win32_PnpSignedDriver
So it seems to be specific to the combination of Get-CimInstance and Win32_PnPSignedDriver. I've tried to rebuild the wmi repository using the following:
winmgmt /verifyrepository
Winmgmt /salvagerepository
But they don't report anything wrong and don't fix the issue. I've also tried to manually rebuild it with command prompt using the following:
sc config winmgmt start= disabled
net stop winmgmt
cd %windir%\system32\wbem
for /f %s in ('dir /b .dll') do regsvr32 /s %s
wmiprvse /regserver
sc config winmgmt start= auto
net start winmgmt
for /f %s in ('dir /b .mof') do mofcomp %s
for /f %s in ('dir /b *.mfl') do mofcomp %s
But no luck. The version of PowerShell on a computer that works and a computer that throws the error are the same. Any ideas on what might be going on?