我们可以通过这种windows配置文件实现winpe、光盘等无人职守安装配置操作系统,在scvmm虚拟化平台中这种文件叫做应答文件。
下面为一个windows server 2008 r2的一个完整应答文件。
1 <?xml version="1.0" encoding="utf-8"?> 2 <unattend xmlns="urn:schemas-microsoft-com:unattend"> 3 <!--配置应用系统设置--> 4 <settings pass="specialize"> 5 <component name="Microsoft-Windows-Shell-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"> 6 <ComputerName>*</ComputerName> 7 <RegisteredOrganization>test01</RegisteredOrganization> 8 <ShowWindowsLive>false</ShowWindowsLive> 9 <ProductKey>RKC6Y-7BD92-KHVMB-HGFBD-R2CR6</ProductKey> 10 </component> 11 <!--windows激活--> 12 <component name="Microsoft-Windows-Security-Licensing-SLC-UX" 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"> 13 <SkipAutoActivation>false</SkipAutoActivation> 14 </component> 15 <!--ie相关配置--> 16 <component name="Microsoft-Windows-IE-ESC" 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"> 17 <IEHardenAdmin>false</IEHardenAdmin> 18 <IEHardenUser>false</IEHardenUser> 19 </component> 20 <!--配置应用系统设置--> 21 <component name="Microsoft-Windows-TerminalServices-LocalSessionManager" 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"> 22 <fDenyTSConnections>false</fDenyTSConnections> 23 </component> 24 <!--ip配置--> 25 <component name="Microsoft-Windows-TCPIP" 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"> 26 <Interfaces> 27 <Interface wcm:action="add"> 28 <Ipv4Settings> 29 <DhcpEnabled>false</DhcpEnabled> 30 <RouterDiscoveryEnabled>false</RouterDiscoveryEnabled> 31 </Ipv4Settings> 32 <Identifier> 33 </Identifier> 34 <UnicastIpAddresses> 35 <IpAddress wcm:action="add" wcm:keyValue="1">192.168.0.182/6</IpAddress> 36 </UnicastIpAddresses> 37 <Routes> 38 <Route wcm:action="add"> 39 <Identifier>0</Identifier> 40 <Prefix>0.0.0.0/0</Prefix> 41 <NextHopAddress>255.255.255.0</NextHopAddress> 42 <Metric>20</Metric> 43 </Route> 44 </Routes> 45 </Interface> 46 <Interface wcm:action="add"> 47 <Ipv4Settings> 48 <DhcpEnabled>false</DhcpEnabled> 49 <RouterDiscoveryEnabled>false</RouterDiscoveryEnabled> 50 </Ipv4Settings> 51 <UnicastIpAddresses> 52 <IpAddress wcm:action="add" wcm:keyValue="1">192.168.3.1/8</IpAddress> 53 </UnicastIpAddresses> 54 <Identifier> 55 </Identifier> 56 </Interface> 57 </Interfaces> 58 </component> 59 <!--dns配置--> 60 <component name="Microsoft-Windows-DNS-Client" 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"> 61 <Interfaces> 62 <Interface wcm:action="add"> 63 <DNSServerSearchOrder> 64 <IpAddress wcm:action="add" wcm:keyValue="1">192.168.0.1</IpAddress> 65 <IpAddress wcm:action="add" wcm:keyValue="2"> 66 </IpAddress> 67 </DNSServerSearchOrder> 68 <Identifier> 69 </Identifier> 70 <EnableAdapterDomainNameRegistration>false</EnableAdapterDomainNameRegistration> 71 <DNSDomain>test01.com</DNSDomain> 72 <DisableDynamicUpdate>true</DisableDynamicUpdate> 73 </Interface> 74 <Interface wcm:action="add"> 75 <DNSServerSearchOrder> 76 <IpAddress wcm:action="add" wcm:keyValue="1">192.168.3.1</IpAddress> 77 <IpAddress wcm:action="add" wcm:keyValue="2"> 78 </IpAddress> 79 </DNSServerSearchOrder> 80 <Identifier> 81 </Identifier> 82 <DisableDynamicUpdate>false</DisableDynamicUpdate> 83 <EnableAdapterDomainNameRegistration>false</EnableAdapterDomainNameRegistration> 84 <DNSDomain>test01.com</DNSDomain> 85 </Interface> 86 </Interfaces> 87 <UseDomainNameDevolution>true</UseDomainNameDevolution> 88 <DNSDomain>test01.com</DNSDomain> 89 </component> 90 <!--本地会话管理器--> 91 <component name="Microsoft-Windows-ServerManager-SvrMgrNc" 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"> 92 <DoNotOpenServerManagerAtLogon>true</DoNotOpenServerManagerAtLogon> 93 </component> 94 <!--oobe--> 95 <component name="Microsoft-Windows-OutOfBoxExperience" 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"> 96 <DoNotOpenInitialConfigurationTasksAtLogon>true</DoNotOpenInitialConfigurationTasksAtLogon> 97 </component> 98 <!--加入工作组--> 99 <component name="Microsoft-Windows-UnattendedJoin" 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"> 100 <Identification> 101 <JoinWorkgroup>WorkGroup</JoinWorkgroup> 102 </Identification> 103 </component> 104 </settings> 105 <!--欢迎界面配置阶段--> 106 <settings pass="oobeSystem"> 107 <!--本地化--> 108 <component name="Microsoft-Windows-International-Core" 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"> 109 <InputLocale>2052:00002052</InputLocale> 110 <SystemLocale>zh-CN</SystemLocale> 111 <UILanguage>zh-CN</UILanguage> 112 <UserLocale>zh-CN</UserLocale> 113 </component> 114 <!--登录密码 分辨率等自定义设置--> 115 <component name="Microsoft-Windows-Shell-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"> 116 <RegisteredOrganization>test01</RegisteredOrganization> 117 <UserAccounts> 118 <AdministratorPassword> 119 <Value>test01!</Value> 120 <PlainText>true</PlainText> 121 </AdministratorPassword> 122 </UserAccounts> 123 <OOBE> 124 <HideEULAPage>true</HideEULAPage> 125 <NetworkLocation>Work</NetworkLocation> 126 <ProtectYourPC>2</ProtectYourPC> 127 <SkipUserOOBE>true</SkipUserOOBE> 128 </OOBE> 129 <Display> 130 <ColorDepth>32</ColorDepth> 131 <HorizontalResolution>800</HorizontalResolution> 132 <VerticalResolution>600</VerticalResolution> 133 </Display> 134 <TimeZone>China Standard Time</TimeZone> 135 </component> 136 </settings> 137 <!--DVD或安装共享位置--> 138 <cpi:offlineImage cpi:source="wim:c:/sources/install.wim#Windows Server 2008 R2 SERVERENTERPRISE" xmlns:cpi="urn:schemas-microsoft-com:cpi" /> 139 </unattend>
在应答文件执行中,可能会出现一些错误,比如当dns的mac地址置空时。
如果在scvmm中出现类似错误,手动去更改应答文件,重新执行作业,依然会出现错误,原因是此时应答文件已被写入vhd镜像。