如何使用PowerShell(winpe)获取Devcon输出的对象?
Posted
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了如何使用PowerShell(winpe)获取Devcon输出的对象?相关的知识,希望对你有一定的参考价值。
我想从Devcon.exe输出中选择一个对象。
PCI\VEN_8086&DEV_2822&SUBSYS_1790103C&REV_04\3&11583659&0&FA
Name: Intel(R) Chipset SATA/PCIe RST Premium Controller
Driver node #0:
Inf file is C:\Windows\INF\iastorav.inf
Inf section is iaStorAVC_inst
Driver description is Intel Chipset SATA RAID Controller
Manufacturer name is Intel Corporation
Provider name is Intel Corporation
Driver date is 2/7/2018
Driver version is 15.44.0.1010
Driver node rank is 16711683
Driver node flags are 00102044
Inf is digitally signed
Driver node #1:
Inf file is C:\Windows\INF\oem9.inf
Inf section is iaStorAC_inst_8
Driver description is Intel(R) Chipset SATA/PCIe RST Premium Controller
Manufacturer name is Intel Corporation
Provider name is Intel Corporation
Driver date is 5/9/2019
Driver version is 17.5.0.1017
Driver node rank is 8388611
Driver node flags are 00003044
Inf is digitally signed
我想通过映射Driver version
获得Driver description
。我尝试过这种方式,但无法获得驱动程序版本。
$hardwareid = "PCI\VEN_8086&DEV_2822&SUBSYS_1790103C&REV_04"
$Description = "Intel(R) Chipset SATA/PCIe RST Premium Controller"
$DrNode = & .\devcon.exe /drivernodes "$hardwareid"
$Ver = $DrNode | Where-Object $_ -like "*$Description*" | Select-Object Driver version
任何人都可以提出想法。非常感谢!
答案
麻烦是devcon输出文本。使用WMI这样的事情怎么样?
Get-WmiObject Win32_PnPSignedDriver |
where description -match 'apple solid state drive device' |
select driverversion
driverversion
-------------
6.0.6400.0
好吧,这对我有用。我在这里得到它:https://superuser.com/questions/1438704/how-to-find-driver-version-for-all-devices-through-wmi/1438715#1438715它从文件信息中获取驱动程序的版本。
get-wmiobject Win32_SystemDriver | select DisplayName,@n="version";
e=(get-item $_.pathname).VersionInfo.FileVersion |
where displayname -match 'apple solid state drive'
DisplayName version
----------- -------
Apple Solid State Drive Device 6.0.6400.0
以上是关于如何使用PowerShell(winpe)获取Devcon输出的对象?的主要内容,如果未能解决你的问题,请参考以下文章
2.如何选择WinPE版本?-日常IT维护必备工具WinPE使用指南系列
powershell Equivalente del comando grep de bash en powershell
powershell Reporte de Actualizaciones WSUS