有两种办法:
1.使用如下命令:
dism /image:%mount% /Set-ProductKey:Key
2.使用sources目录下的autounattend.xml文件,类似的内容可由WAIK的Windows System Image Manager工具生成:
<?xml version="1.0" encoding="utf-8"?>
<unattend xmlns="urn:schemas-microsoft-com:unattend">
<settings pass="windowsPE">
<component name="Microsoft-Windows-Setup" processorArchitecture="amd64" publicKeyToken="31bf3856ad364e35" language="neutral" versionScope="nonSxS" xmlns:wcm="http://schemas.microsoft.com/WMIConfig/2002/State" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<UserData>
<ProductKey>
<WillShowUI>OnError</WillShowUI>
<Key>Key</Key>
</ProductKey>
</UserData>
</component>
</settings>
<cpi:offlineImage cpi:source="" xmlns:cpi="urn:schemas-microsoft-com:cpi" />
</unattend>
<unattend xmlns="urn:schemas-microsoft-com:unattend">
<settings pass="windowsPE">
<component name="Microsoft-Windows-Setup" processorArchitecture="amd64" publicKeyToken="31bf3856ad364e35" language="neutral" versionScope="nonSxS" xmlns:wcm="http://schemas.microsoft.com/WMIConfig/2002/State" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<UserData>
<ProductKey>
<WillShowUI>OnError</WillShowUI>
<Key>Key</Key>
</ProductKey>
</UserData>
</component>
</settings>
<cpi:offlineImage cpi:source="" xmlns:cpi="urn:schemas-microsoft-com:cpi" />
</unattend>
关于MOUNT目录
set mount=D:\temp\mount
set source=D:\temp\win7
set wim=%source%\sources\install.wim
dism /mount-wim /wimfile:%wim% /index:4 /mountdir:%mount%
set source=D:\temp\win7
set wim=%source%\sources\install.wim
dism /mount-wim /wimfile:%wim% /index:4 /mountdir:%mount%
如果是想在重新封装或者用imagex把映像安装后用bcdboot配置的方式安装,用应答文件来控制的话,key集成在<settings pass="windowsPE">阶段就不起作用了,可以把key放在<settings pass="specialize">阶段
<settings pass="specialize">
<component name="Microsoft-Windows-Shell-Setup" processorArchitecture="x86" publicKeyToken="31bf3856ad364e35" language="neutral" versionScope="nonSxS" xmlns:wcm="http://schemas.microsoft.com/WMIConfig/2002/State" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<BluetoothTaskbarIconEnabled>true</BluetoothTaskbarIconEnabled>
<ComputerName>windows</ComputerName>
<CopyProfile>true</CopyProfile>
<DisableAutoDaylightTimeSet>true</DisableAutoDaylightTimeSet>
<DoNotCleanTaskBar>true</DoNotCleanTaskBar>
<RegisteredOrganization>windows7</RegisteredOrganization>
<RegisteredOwner>windows7</RegisteredOwner>
<ShowWindowsLive>true</ShowWindowsLive>
<StartPanelOff>false</StartPanelOff>
<TimeZone>China Standard Time</TimeZone>
<ProductKey>22TKD-F8XX6-YG69F-9M66D-PMJBM</ProductKey>
</component>
</settings>
<component name="Microsoft-Windows-Shell-Setup" processorArchitecture="x86" publicKeyToken="31bf3856ad364e35" language="neutral" versionScope="nonSxS" xmlns:wcm="http://schemas.microsoft.com/WMIConfig/2002/State" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<BluetoothTaskbarIconEnabled>true</BluetoothTaskbarIconEnabled>
<ComputerName>windows</ComputerName>
<CopyProfile>true</CopyProfile>
<DisableAutoDaylightTimeSet>true</DisableAutoDaylightTimeSet>
<DoNotCleanTaskBar>true</DoNotCleanTaskBar>
<RegisteredOrganization>windows7</RegisteredOrganization>
<RegisteredOwner>windows7</RegisteredOwner>
<ShowWindowsLive>true</ShowWindowsLive>
<StartPanelOff>false</StartPanelOff>
<TimeZone>China Standard Time</TimeZone>
<ProductKey>22TKD-F8XX6-YG69F-9M66D-PMJBM</ProductKey>
</component>
</settings>
Windows 7集成序列号的方式:等您坐沙发呢!