WAIK: 离线安装Windows驱动程序

作者: lesca 分类: Tutorials,Windows 发布时间: 2012-10-17 11:41

方法一:通过dism命令注入

1.挂载WIM镜像:

Dism /Mount-Wim /WimFile:install.wim /Index:2 /MountDir:mount

2.删除之前安装的驱动:

Dism /Image:mount /Remove-Driver /Driver:OEM1.inf /Driver:OEM2.inf ... /Driver:OEM99.inf

3.注入驱动

Dism /Image:mount /Add-Driver /Driver:C:\D /Recurse /ForceUnsigned

注意:
预安装Nvidia显卡驱动时出现如下错误:

D:\Drivers\NVIDIADisplay_S20\Display.Driver\NVLW.INF: Error - An error occurred. The driver package could not be installed. 

是因为文件没有解压造成的,可以通过expand命令解压:

mkdir expanded
expand NVIDIA\Display.Direvers\* expaned\

如果仍不能解决,可以查看日志:

<MountFolder>\Windows\inf\setupapi.offline.log

4.卸载镜像

Dism /Unmount-Wim /MountDir:C:\offline /Commit

方法二:通过$OEM$文件夹载入

sources目录下创建$OEM$\$$\Inf\D目录,将驱动程序放入该文件夹下即可。该方法仅在Windows第一次启动时有效,并且仅加载已连接到计算机上的设备驱动程序。安装完后,可以删除该文件夹。

方法三:通过网络路径安装

通过Windows System Image Manager添加“Credentials”节点

├─Microsoft-Windows-PnpCustomizationsNonWinPE 
│  ├─DevicePaths
│  │  └─PathAndCredentials 
│  │      └─Credentials

填写以下黑体中的信息:

<?xml version="1.0" ?>
<unattend xmlns="urn:schemas-microsoft-com:asm.v3" xmlns:wcm="http://schemas.microsoft.com/WMIConfig/2002/State">
   <settings pass="offlineServicing">
      <component name="Microsoft-Windows-PnpCustomizationsNonWinPE" processorArchitecture="x86" publicKeyToken="31bf3856ad364e35" language="neutral" versionScope="nonSxS">
         <DriverPaths>
            <PathAndCredentials wcm:keyValue="1">
               <Path>\\networkshare\share\drivers</Path>
               <Credentials>
                  <Domain>Fabrikam</Domain>
                  <Username>MyUserName</Username>
                  <Password>MyPassword</Password>
               </Credentials>
            </PathAndCredentials>
         </DriverPaths>
      </component>
   </settings>
</unattend>

References:

[1] Fully unattended win7 x64 install with integrated (not injected) unsigned drivers…
[2] Question about injecting drivers via DISM
[3] Limitations of $WinPeDriver$ when used in conjunction with other driver injection methods
[4] Add Drivers to an Offline Windows Image by Using an Unattended Answer File

版权声明

本文出自 Lesca 技术宅,转载时请注明出处及相应链接。

本文永久链接: https://www.lesca.cn/archives/waik-inject-windows-drivers-offline.html

如果觉得我的文章对您有用,请随意赞赏。您的支持将鼓励我继续创作!