是否有安装和删除Windows驱动程序的Powershell cmdlet?

问题描述 投票:3回答:2

注意:对于这个问题,当我提到“ Windows驱动程序”时,我是指.inf和相关文件,否则可以通过右键单击.inf并在Windows资源管理器中单击“安装”来安装。我不是说可能会安装驱动程序的任何setup.exe风格的可执行文件。


存在以下内容:

  • Get-WindowsDriver -online-输出正在安装的正在运行的系统的驱动程序的Powershell Cmdlet
  • Get-WindowsDriver -online-将驱动程序添加到脱机映像的Powershell Cmdlet。相应的Add-WindowsDriver可用于从脱机映像中删除驱动程序。
  • Add-WindowsDriver-Remove-WindowsDriver的命令行工具。 Remove-WindowsDriver可与一起使用以卸载驱动程序。

但是,我还没有找到相应的Powershell Cmdlet,它支持在运行系统上安装和卸载驱动程序。我确定我可以将dpinst.exe包装在某些powershell中,但是如果存在更多的Powershell本机方法,我想避免映射命令行参数和解析输出。

是否存在在正在运行的系统上安装和卸载Windows驱动程序的Powershell Cmdlet?还有使用Powershell安装和卸载不涉及dpinst.exe的Windows驱动程序的其他方法吗?

windows powershell driver cmdlets
2个回答
4
投票

不仅没有用于此的PowerShell cmdlet,i can be used to install a driver to the running system(以下基本上是该答案到PowerShell的翻译)。

幸运的是,.Net框架可以通过平台调用(p / invoke)调用Windows API,而PowerShell也可以。

链接的答案显示了如何在C#中执行此操作。为此,我们将使用该答案中生成的签名,并与dpinst.exe /u结合使用,以使其可用于您的脚本。

dpinst.exe

有关参数(尤其是字符串格式)的详细信息,请参见dpinst.exe


0
投票
© www.soinside.com 2019 - 2024. All rights reserved.