portable-executablefindstrwinpe

windowspe - find devices whitout proper driver


I'm trying to automate the installation of drivers with windows PE. After booting PE and looking for the devices I get such an output:

devcon status *pci*
PCI\VEN_8086&DEV_0C05&SUBSYS_11F41734&REV_06\3&11583659&0&09
    Name: PCI standard PCI-to-PCI bridge
    Driver is running.
PCI\VEN_19A2&DEV_0800&SUBSYS_11CC1734&REV_00\4&313340F4&0&01E0
    Name: Coprocessor
    The device has the following problem: 28

Now, I'm only interested in the devices with an error/problem.

How can I figure out which devices are affected?

I tried it with findstr:

devcon status *pci* | findstr /n /i "pci\\ name problem"

But i always get all devices, not only the faulty ones.

The easiest way seems to use a file

devcon status *pci* > devcon.txt
findstr /n /i "problem" devcon.txt

with this I get the line numbers. But how can I read now the line 2 lines above the line containing "problem"?


Solution

  • so, after one day of research i can answer myself my question ;)

    the easyiest way to solve this problem is linux grep (from cygwin64)

    i´ve installed cygwin and copied this files to pe

    my commandline looks now like this

    devcon status *pci * | grep -B2 -i -e problem -e stopped > errors.txt

    probably i can shorten this command, but i´m happy thats working.

    netlord