admin 管理员组文章数量: 887016
参考Windows 7的做法,来实现Win8.x的部署
原文链接:http://www.imuyang/article-4883-2.html
了解DISM
DISM.exe是新的命令行工具,在操作系统Windows 7的默认安装中和自动安装工具Windows AIK 2.0中都可以看到该工具的身影。
注意:以可启动的Windows镜像方式对VHD文件提供支持是Windows 7中出现的一个新功能,我们会在本系列其他文章中对该功能进行介绍。
我们可以使用DISM.exe操作Windows镜像,这其中包括Windows 镜像文件(WIM)和虚拟硬盘文件(VHD)。虽然DISM.exe主要用于操作离线的Windows 镜像,但是它的一些功能也可以用来为在线的Windows操作系统提供管理。我们所说的操作镜像意指添加或删除设备驱动,添加或删除操作系统补丁,添加hotfixes,配置镜像的区域设定以及其他相应操作。DISM还可以用来将Windows镜像更新至不同版本(如从商业版更新至旗舰版),并准备一个Windows PE镜像以供使用。
我们可以用DISM对以下版本的镜像进行修复:
·Windows Vista SP1 及之后版本
·Windows Server 2008
·Windows 7
·Windows Server 2008 R2
使用DISM
在Windows Vista(或Windows AIK 1.1)中编辑一个镜像需要使用若干不同的工具。例如我们要在主安装的镜像上安装一个不合常规的设备驱动,如果想在Vista中实现这一操作,要按照以下步骤:
1.用ImageX装载镜像
2.用数据包管理器(Pkgmgr.exe)添加设备驱动器
3.用ImageX卸载镜像
此外,如果我们的镜像是一个Windows PE镜像,那么还需要使用Windows Preinstallation Environment(PEimg.exe)工具来配置该镜像。最后,如果需要修改镜像的语言和本地设置,我们还要使用International Settings Configuration Tool(Intlcfg.exe)。
但是,如果要在Windows 7中完成这一操作,要怎么办呢?DISM.exe现在已经取代了早前Windows AIK 1.1版本中的Pkgmgr.exe,Intlcfg.exe和PEimg.exe工具。另外,DISM还包括装载和卸载镜像的功能,因此我们可以对镜像进行编辑。
通常,我们利用DISM把某个设备驱动添加到离线的Windows 镜像中,然后再将该镜像部署到需要这一驱动的硬件上。让我们浏览一遍完成该操作的命令行以便学习如何使用DISM。
首先,在我们的Windows AIK 2.0电脑上的C:\Images 文件夹中可以找到一个用于Windows 7的Windows安装镜像(install.wim文件):
C:\Program Files\Windows AIK\Tools\PETools>dir C:\Images Volume in drive C has no label. Volume Serial Number is 1C9A-D699
Directory of C:\Images
05/03/2009 12:46 PM <DIR> . 05/03/2009 12:46 PM <DIR> .. 04/22/2009 07:28 AM 2,218,242,699 install.wim 1 File(s) 2,218,242,699 bytes 2 Dir(s) 180,411,486,208 bytes free |
下面,在 C:\Drivers 文件夹下是Microsoft LifeCam硬件的Windows 7 beta驱动程序(version 2.91):
C:\Program Files\Windows AIK\Tools\PETools>dir C:\Drivers Volume in drive C has no label. Volume Serial Number is 1C9A-D699
Directory of C:\Drivers
05/03/2009 01:19 PM <DIR> . 05/03/2009 01:19 PM <DIR> .. 05/03/2009 01:19 PM <DIR> VX6000 0 File(s) 0 bytes 3 Dir(s) 180,411,486,208 bytes free |
我们要把镜像装载到名为C:\Servicing的空文件夹中。先让我们使用带有 /get-wiminfo 参数的DISM.exe命令行来显示包含在install.wim文件中的所有Windows镜像。记住,一个安装镜像可以包含一个以上的Windows镜像。
C:\Program Files\Windows AIK\Tools\PETools>dism /get-wiminfo /wimfile:C:\Images\install.wim
Deployment Image Servicing and Management tool Version: 6.1.7100.0
Details for image : C:\Images\install.wim
Index : 1 Name : Windows 7 STARTER Description : Windows 7 STARTER Size : 7,927,317,234 bytes
Index : 2 Name : Windows 7 HOMEBASIC Description : Windows 7 HOMEBASIC Size : 7,983,232,406 bytes
Index : 3 Name : Windows 7 HOMEPREMIUM Description : Windows 7 HOMEPREMIUM Size : 8,422,988,972 bytes
Index : 4 Name : Windows 7 PROFESSIONAL Description : Windows 7 PROFESSIONAL Size : 8,303,245,818 bytes
Index : 5 Name : Windows 7 ULTIMATE Description : Windows 7 ULTIMATE Size : 8,461,373,562 bytes
The operation completed successfully. |
现在,假设我们即将部署Windows 7 专业版,在此案例中,从上面的命令行中可以看出,在这一特定镜像中,Index数为4。因此,让我们利用DISM.exe命令中的 /mount-wim 参数把这一特定Windows镜像加载到空的C:\Servicing 文件夹中。
C:\Program Files\Windows AIK\Tools\PETools>dism /mount-wim /wimfile:C:\Images\install.wim /index:4 /mountdir:C:\Servicing
Deployment Image Servicing and Management tool Version: 6.1.7100.0
Mounting image [==========================100.0%==========================] The operation completed successfully. |
使用/get-mountedinfo 参数可以查看镜像是否已经正确加载:
C:\Program Files\Windows AIK\Tools\PETools>dism /get-mountedwiminfo
Deployment Image Servicing and Management tool Version: 6.1.7100.0
Mounted images:
Mount Dir : C:\Servicing Image File : C:\Images\install.wim Image Index : 4 Mounted Read/Write : Yes Status : Ok
The operation completed successfully. |
如果我们查看C:\Servicing 目录的内容,就会看到已加载镜像的文件和目录。
C:\Program Files\Windows AIK\Tools\PETools>dir C:\Servicing Volume in drive C has no label. Volume Serial Number is 1C9A-D699
Directory of C:\Servicing
04/22/2009 03:36 AM <DIR> . 04/22/2009 03:36 AM <DIR> .. 03/20/2009 10:42 AM 24 autoexec.bat 03/20/2009 10:42 AM 10 config.sys 04/22/2009 01:17 AM <DIR> PerfLogs 04/22/2009 05:26 AM <DIR> Program Files 04/22/2009 03:27 AM <DIR> Users 04/22/2009 05:29 AM <DIR> Windows 2 File(s) 34 bytes 6 Dir(s) 180,321,382,400 bytes free |
现在,让我们查看一下在已装载镜像可以执行哪些操作:
C:\Program Files\Windows AIK\Tools\PETools>dism /image:C:\Servicing /?
Deployment Image Servicing and Management tool Version: 6.1.7100.0
Image Version: 6.1.7100.0
The following commands may be used to service the image:
WINDOWS EDITION SERVICING COMMANDS:
/Set-ProductKey - Populates the product key into the offline image. /Get-TargetEditions - Displays a list of Windows editions that an image can be upgraded to. /Get-CurrentEdition - Displays the editions of the specified image. /Set-Edition - Upgrades the Windows image to a higher edition.
UNATTEND SERVICING COMMANDS:
/Apply-Unattend - Applies an unattend file to an image.
DRIVER SERVICING COMMANDS:
/Remove-Driver - Removes driver packages from an offline image. /Add-Driver - Adds driver packages to an offline image. /Get-DriverInfo - Displays information about a specific driver in an offline image or a running operating system. /Get-Drivers - Displays information about all drivers in an offline image or a running operating system.
INTERNATIONAL SERVICING COMMANDS:
/Set-LayeredDriver - Sets keyboard layered driver. /Set-UILang - Sets the default system UI language that is used in the mounted offline image. /Set-UILangFallback - Sets the fallback default language for the system UI in the mounted offline image. /Set-UserLocale - Sets the user locale in the mounted offline image. /Set-SysLocale - Sets the language for non-Unicode programs (also called system locale) and font settings in the mounted offline image. /Set-InputLocale - Sets the input locales and keyboard layouts to use in the mounted offline image. /Set-TimeZone - Sets the default time zone in the mounted offline image. /Set-AllIntl - Sets all international settings in the mounted offline image. /Set-SKUIntlDefaults - Sets all international settings to the default values for the specified SKU language in the mounted offline image. /Gen-LangIni - Generates a new lang.ini file. /Set-SetupUILang - Defines the default language that will be used by setup. /Get-Intl - Displays information about the international settings and languages.
APPLICATION SERVICING COMMANDS:
/Check-AppPatch - Displays information if the MSP patches are applicable to the mounted image. /Get-AppPatchInfo - Displays information about installed MSP patches. /Get-AppPatches - Displays information about all applied MSP patches for all installed applications. /Get-AppInfo - Displays information about a specific installed MSI application. /Get-Apps - Displays information about all installed MSI applications.
PACKAGE SERVICING COMMANDS:
/Add-Package - Adds packages to the image. /Remove-Package - Removes packages from the image. /Enable-Feature - Enables a specific feature in the image. /Disable-Feature - Disables a specific feature in the image. /Get-Packages - Displays information about all packages in the image. /Get-PackageInfo - Displays information about a specific package. /Get-Features - Displays information about all features in a package. /Get-FeatureInfo - Displays information about a specific feature. /Cleanup-Image - Performs cleanup and recovery operations on the image.
For more information about these servicing commands and their arguments, specify a command immediately before /?.
Examples: DISM.exe /Image:C:\test\offline /Apply-Unattend /? DISM.exe /Image:C:\test\offline /Get-Features /? DISM.exe /Online /Get-Drivers /? |
C:\Program Files\Windows AIK\Tools\PETools>dism /image:C:\Servicing /get-drivers
Deployment Image Servicing and Management tool Version: 6.1.7100.0
Image Version: 6.1.7100.0
Obtaining list of 3rd party drivers from the driver store...
Driver packages listing:
Published Name : oem0.inf Original File Name : prnms001.inf Inbox : No Class Name : Printer Provider Name : Microsoft Date : 6/21/2006 Version : 6.1.7100.0
The operation completed successfully. |
现在可以用/add-driver 参数把LifeCam驱动添加到已装载镜像中:
C:\Program Files\Windows AIK\Tools\PETools>dism /image:C:\Servicing /add-driver /driver:C:\Drivers\VX6000\vx6000.inf
Deployment Image Servicing and Management tool Version: 6.1.7100.0
Image Version: 6.1.7100.0
Found 1 driver package(s) to install. Installing 1 of 1 - C:\Drivers\VX6000\vx6000.inf: The driver package was successfully installed. The operation completed successfully. Let's use /get-drivers again to verify that the LifeCam driver has been successfully added to the mounted image: C:\Program Files\Windows AIK\Tools\PETools>dism /image:C:\Servicing /get-drivers
Deployment Image Servicing and Management tool Version: 6.1.7100.0
Image Version: 6.1.7100.0
Obtaining list of 3rd party drivers from the driver store...
Driver packages listing:
Published Name : oem0.inf Original File Name : prnms001.inf Inbox : No Class Name : Printer Provider Name : Microsoft Date : 6/21/2006 Version : 6.1.7100.0
Published Name : oem1.inf Original File Name : vx6000.inf Inbox : No Class Name : Image Provider Name : Microsoft Date : 7/18/2008 Version : 5.5.3.74
The operation completed successfully. |
C:\Program Files\Windows AIK\Tools\PETools>dism /unmount-wim /mountdir:C:\Servicing /commit
Deployment Image Servicing and Management tool Version: 6.1.7100.0
Image File : C:\Images\install.wim Image Index : 4 Saving image [==========================100.0%==========================] Unmounting image [==========================100.0%==========================] The operation completed successfully. |
其他资源
要获取更多有关DISM.exe的使用信息,在Deployment Tools Command Prompt中输入dism/?。另外,还可以点击“开始”菜单,从程序中找到Windows AIK用户指导(WAIK.chm),在其中的Deployment Tools Technical Reference部分也可以找到有关DISM.exe的详细信息。
版权声明:本文标题:企业 Windows 7 部署指南之——使用DISM 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.freenas.com.cn/jishu/1728029319h1189800.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论