对于softice来说,几乎每天都要摆弄摆弄终端服务器,靠它吃饭了,深情地表白下,终端终端我爱你,如果我是老鼠,你就是大米。去客户现场时,如果系统装好了,还好玩,使用个servermanagercmd.exe的命令,搞个批处理,把角色一装,再使用写好的各种脚本一导,脚本是个好同志,长得比较晦涩,但是代码间藏着各种配置,是softice做项目标准化的好帮手,最后搞定收工。
而有时呢,客户那边就准备个服务器,系统也没有,什么都要你自己来吧。softice就用Windows AIK弄了张Windows Server 2008的自动安装光盘,让它自己装吧,系统装完了,终端角色也有了,再走脚本的套路,多的只是自动安装时等的一个半个钟。
怎么使用AIK中的工具,这里就不多废话了,前面有一篇关于制作VHD母盘的文档,照抄照做,就知道怎么生成应答文件了,这里直接给出应答文件。
 
xml version ="1.0" encoding ="utf-8" ?>
< unattend xmlns ="urn:schemas-microsoft-com:unattend" >
         < servicing >
                 < package action ="configure" >
                         < assemblyIdentity name ="Microsoft-Windows-Foundation-Package" version ="6.0.6001.18000" processorArchitecture ="x86" publicKeyToken ="31bf3856ad364e35" language="" />
                         < selection name ="AppServer-UI" state ="true" />
                         < selection name ="Licensing" state ="true" />
                         < selection name ="Licensing-UI" state ="true" />
                         < selection name ="AppServer" state ="true" />
                 package >
         servicing >
         < settings pass ="windowsPE" >
                 < component name ="Microsoft-Windows-International-Core-WinPE" 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" >
                         < SetupUILanguage >
                                 < UILanguage >zh-cn UILanguage >
                         SetupUILanguage >
                         < InputLocale >zh-cn InputLocale >
                         < SystemLocale >zh-cn SystemLocale >
                         < UILanguage >zh-cn UILanguage >
                         < UILanguageFallback >zh-cn UILanguageFallback >
                         < UserLocale >zh-cn UserLocale >
                 component >
                 < component name ="Microsoft-Windows-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" >
                         < ImageInstall >
                                 < OSImage >
                                         < InstallFrom >
                                                 < MetaData wcm:action ="add" >
                                                         < Key >/IMAGE/INDEX Key >
                                                         < Value >2 Value >
                                                 MetaData >
                                         InstallFrom >
                                 OSImage >
                         ImageInstall >
                         < UserData >
                                 < AcceptEula >true AcceptEula >
                                 < FullName >softice FullName >
                                 < Organization >Microsoft Organization >
                         UserData >
                 component >
         settings >
         < settings pass ="oobeSystem" >
                 < 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" >
                         < UserAccounts >
                                 < AdministratorPassword >
                                         < Value >cABhAHMAcwB3AG8AcgBkADAAMQAhAEEAZABtAGkAbgBpAHMAdAByAGEAdABvAHIAUABhAHMAcwB3AG8AcgBkAA== Value >
                                         < PlainText >false PlainText >
                                 AdministratorPassword >
                         UserAccounts >
                         < OOBE >
                                 < HideEULAPage >true HideEULAPage >
                                 < NetworkLocation >Work NetworkLocation >
                                 < ProtectYourPC >1 ProtectYourPC >
                         OOBE >
                 component >
         settings >
         < 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" >
                         < AutoLogon >
                                 < Password >
                                         < Value >cABhAHMAcwB3AG8AcgBkADAAMQAhAFAAYQBzAHMAdwBvAHIAZAA= Value >
                                         < PlainText >false PlainText >
                                 Password >
                                 < Username >administrator Username >
                                 < Enabled >true Enabled >
                         AutoLogon >
                         < ComputerName >TSServer ComputerName >
                         < TimeZone >China Standard Time TimeZone >
                         < RegisteredOwner >softice RegisteredOwner >
                 component >
                 < component name ="Microsoft-Windows-IE-ESC" 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" >
                         < IEHardenAdmin >false IEHardenAdmin >
                         < IEHardenUser >false IEHardenUser >
                 component >
                 < component name ="Microsoft-Windows-TerminalServices-RDP-WinStationExtensions" 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" >
                         < UserAuthentication >1 UserAuthentication >
                 component >
                 < component name ="Microsoft-Windows-TerminalServices-LocalSessionManager" 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" >
                         < fDenyTSConnections >false fDenyTSConnections >
                 component >
                 < component name ="Microsoft-Windows-TerminalServices-RemoteConnectionManager" 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" >
                         < LicensingMode >2 LicensingMode >
                 component >
                 < component name ="Networking-MPSSVC-Svc" 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" >
                         < FirewallGroups >
                                 < FirewallGroup wcm:action ="add" wcm:keyValue ="RemoteDesktop" >
                                         < Group >@FirewallAPI.dll,-28752 Group >
                                         < Profile >all Profile >
                                         < Active >true Active >
                                 FirewallGroup >
                         FirewallGroups >
                 component >
                 < component name ="Microsoft-Windows-ServerManager-SvrMgrNc" 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" >
                         < DoNotOpenServerManagerAtLogon >true DoNotOpenServerManagerAtLogon >
                 component >
                 < component name ="Microsoft-Windows-OutOfBoxExperience" 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" >
                         < DoNotOpenInitialConfigurationTasksAtLogon >true DoNotOpenInitialConfigurationTasksAtLogon >
                 component >
         settings >
         < cpi:offlineImage cpi:source ="catalog:c:/windows server 2008/sources/install_windows longhorn serverenterprise.clg" xmlns:cpi ="urn:schemas-microsoft-com:cpi" />
unattend >
 
这是一个Windows Server 2008 SP2的应答文件,他实现了以下的功能:
1、自动安装终端服务角色;
2、自动安装终端服务授权服务角色;
3、在防火墙上允许开放远程桌面服务;
4、终端服务的授权模式为每设备;
5、对管理员和普通用户禁用IE SEC功能;
6、禁用初始配置界面;
7、禁用自动启动服务器管理器;
8、计算机名为TSServer;
9、启用网络级身份验证(NLA)功能;
10、管理员密码设置为password01!,并且实现自动登录;
11、没有对磁盘进行初始化分区等功能,考虑到用户的服务器磁盘本来就有数据,整个安装过程中,只有这一步需要人工干预操作;
 
给出应答文件以后,我们要做的下一步,就是把这个应答文件集成在Windows Server 2008的光盘中,可以直接把它保存为AutoUnattend.xml文件,放在光盘的根目录下,