Sysprep BizTalk Server VHD (BizTalk Server 示例)
Sysprep 创建虚拟机的快照,其中安装了 BizTalk Server,以便在其他虚拟机上快速部署。
先决条件
在使用 Sysprep 之前,应了解将虚拟机与 Hyper-V 配合使用。 还应有一个虚拟机,其中包含BizTalk Server及其所有先决条件的干净典型安装。
Sysprep 将在 Windows Server 2008 和 Windows Vista SP1 上运行。
本示例的用途
Sysprep 创建BizTalk Server安装的 VHD, (包括操作系统和所有先决条件,) 在其他虚拟机上快速部署。 使用 Sysprep 创建的映像将选择一个新的计算机名称,以便在首次启动时即可加入域。 若要使 BizTalk Server 正常运行,需要更新存储在注册表和数据库中的计算机名称的各种实例。
此文档假设将 BizTalk Server 配置为在单个计算机上运行,并演示如何使用新名称更新计算机名称的其他实例。
本示例所在的位置
本示例位于以下 SDK 位置中:
<示例路径>\管理员\Sysprep\
下表显示了本示例中的文件及其用途说明:
注意
下表中的 .vbs 和 .cmd 文件将在 Sysprep 应答文件(Sysprep.xml 和 SetupCompletecmd.txt)中自动运行,在此处列出仅供参考。 如果你需要手动运行这些脚本,请按照表中出现的顺序运行。
文件 | 说明 |
---|---|
Sysprep.xml | 应答文件 |
SetupCompletecmd.txt | 应答文件 |
ReplaceMachineName.vbs | 目的:打开一个文件,并将给定字符串的所有实例替换为当前计算机名称。 这对于准备其他脚本和 xml 文件及更新 bm.exe.config 非常有用。 用法:ReplaceMachineName.vbs <文件打开><要替换的字符串> |
UpdateRegistry.vbs | 用途:汇报 BizTalk 注册表设置中存储的计算机名称。 用法:UpdateRegistry.vbs <UpdateInfo.xml>。 请确保替换此 xml 文件中的所有 $(OLDCOMPUTERNAME) 和 $(NEWCOMPUTERNAME) 实例。 |
UpdateDatabase.vbs | 用途:汇报 BizTalk 管理数据库中存储的计算机名称。 用法:UpdateDatabase.vbs <UpdateInfo.xml> |
UpdateBAMDb.vbs | 用途:汇报 BAM 数据库中存储的计算机名称。 用法:UpdateBamDb.vbs <UpdateInfo.xml> |
UpdateSSO.cmd | 目的:) 机密服务器重新配置企业单一登录 (SSO。 用法:sso.cmd <UpdateInfo.xml> |
UpdateSqlServerAndInstanceName.cmd | 目的:重新配置 SQL 和 SQL Express,重启一系列依赖服务,并重新注册 BAMAlerts。 用法:编辑脚本并替换 $ (NEWCOMPUTERNAME) 的所有实例,并更新 BAM 警报的 serviceusername 和 servicepassword。 然后运行 UpdateSqlServerAndInstanceName.cmd,作为第一个参数传递旧计算机名称。 |
创建应答文件和运行 Sysprep
创建应答文件
在虚拟机上安装和配置BizTalk Server。 确保使用默认安装和配置选项,因为 Sysprep 不支持自定义安装。
将包括的“scripts”文件夹中的内容复制到虚拟机上的 C:\Scripts。
通过在 Sysprep.xml 中修改以下行来准备 sysprep 应答文件。 (注意:这些行前面标有“!”。) 可以将这些行用作模板,也可以自行创建并复制 <FirstLogonCommands> 部分。
$(OLDCOMPUTERNAME) 替换为虚拟机的当前计算机名称。
用户帐户
密码
还应更新 UpdateSqlServerAndInstance.cmd 和你 Sysprep.xml 中的任何公司详细信息。
或者,可以使用 Windows Server 2008 上的 自动安装工具包 (AIK) 从头开始创建 Sysprep 应答文件。 确保 <FirstLogonCommands> 部分与示例匹配,以便 BizTalk 脚本将在首次启动时运行。
运行 Sysprep
打开命令提示符,然后运行 Sysprep。 该命令将如下所示:
C:\windows\system32\sysprep\sysprep.exe /oobe /generalize /shutdown /unattend:c:\scripts\unattend_Win2K8x64.xml
Sysprep 要运行约半小时。 完成后,它将自动关闭虚拟机。
关闭虚拟机后,合并所有快照,并将你的 VHD 文件复制到安全位置。
现在 VHD 已经准备就绪,可部署到其他虚拟机上,包含操作系统、BizTalk Server 和所有先决条件。
SetupCompletecmd.txt
del /Q /F c:\windows\system32\sysprep\sysprep.xml
SqlCmd -s . -d Repository -A -Q "drop login [PDC08-CSD\Administrator]"
SqlCmd -s . -d Repository -A -Q "create login [$(COMPUTERNAME)\Administrator] from windows"
SqlCmd -s . -d Repository -A -Q "EXEC sp_changedbowner [$(COMPUTERNAME)\Administrator]"
Sysprep.xml
- <!--
References:
"Unattended Installation Settings Reference" @ https://technet.microsoft.com/library/cc749204.aspx
"How to Sysprep in Windows 2008 " @ http://briandesmond.com/blog/how-to-sysprep-in-windows-2008
Make sure to modify the values specified for the
<Credentials> and <DomainAccounts> sections of this unattend file.
SetupComplete.cmd should be copied to the C:\Windows\Setup\Scripts\ folder before running sysprep.
Contents of SetupComplete.cmd:
del /Q /F c:\windows\system32\sysprep\sysprep.xml
SqlCmd -s . -d Repository -A -Q "drop login [PDC08-CSD\Administrator]"
SqlCmd -s . -d Repository -A -Q "create login [$(COMPUTERNAME)\Administrator] from windows"
SqlCmd -s . -d Repository -A -Q "EXEC sp_changedbowner [$(COMPUTERNAME)\Administrator]"
Sysprep.xml (this file) should be copied to the C:\Windows\System32\sysprep\ folder.
Run sysprep with the following options:
sysprep /generalize /oobe /shutdown /unattend:sysprep.xml
-->
<?xml version="1.0" encoding="utf-8" ?>
- <unattend xmlns="urn:schemas-microsoft-com:unattend">
- <settings pass="oobeSystem">
- <component name="Microsoft-Windows-International-Core" 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">
<InputLocale>0409:00000409</InputLocale>
<SystemLocale>en-US</SystemLocale>
<UILanguage>en-US</UILanguage>
<UILanguageFallback>en-US</UILanguageFallback>
<UserLocale>en-US</UserLocale>
</component>
- <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>
- <!--
This sets the password for the Administrator account back to pass@word1
-->
- <AdministratorPassword>
<Value>pass@word1</Value>
<PlainText>true</PlainText>
</AdministratorPassword>
- <!--
Enter the appropriate value for the <Name> and <Domain> elements here,
this group/account will be added to the local Administrators and Remote Desktop Users groups.
-->
- <DomainAccounts>
- <DomainAccountList wcm:action="add">
- <DomainAccount wcm:action="add">
<Name>MSMQ4TR</Name>
<Group>Administrators;RemoteDesktopUsers</Group>
</DomainAccount>
<Domain>Northamerica.corp.microsoft.com</Domain>
</DomainAccountList>
- <!--
Additional DomainAccountList section. Uncomment/modify this section if you need to add
groups / users from multiple domains to the local Administrators and Remote Desktop Users groups.
<DomainAccountList wcm:action="add">
<DomainAccount wcm:action="add">
<Name>OsloVM_NTDev</Name>
<Group>Administrators;RemoteDesktopUsers</Group>
</DomainAccount>
<Domain>Ntdev.corp.microsoft.com</Domain>
</DomainAccountList>
-->
</DomainAccounts>
</UserAccounts>
- <!--
The new computer name is generated using a combination of <RegisteredOwner>, <RegisteredOrganization>, and random alphanumeric characters. Since <RegisteredOrganization> is blank, the new computer name will be OsloVPC-*******.
-->
<RegisteredOwner>OsloVPC</RegisteredOwner>
<TimeZone>Pacific Standard Time</TimeZone>
- <Display>
<ColorDepth>16</ColorDepth>
<HorizontalResolution>1024</HorizontalResolution>
<VerticalResolution>768</VerticalResolution>
</Display>
<RegisteredOrganization />
<StartPanelOff>true</StartPanelOff>
<ShowWindowsLive>false</ShowWindowsLive>
<DoNotCleanTaskBar>true</DoNotCleanTaskBar>
<DisableAutoDaylightTimeSet>false</DisableAutoDaylightTimeSet>
<BluetoothTaskbarIconEnabled>false</BluetoothTaskbarIconEnabled>
- <VisualEffects>
<FontSmoothing>ClearType</FontSmoothing>
</VisualEffects>
</component>
</settings>
- <settings pass="specialize">
- <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-UnattendedJoin" 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">
- <!--
Enter credentials for a user account that has permissions to join a computer to the domain specified in the <JoinDomain> element. (Note: you must enter your password in plaintext here. This file will be deleted at the conclusion of Windows setup by SetupComplete.cmd in the C:\Windows\Setup\Scripts\ folder. For more information see the bottom of "How to Sysprep in Windows 2008" @ http://briandesmond.com/blog/how-to-sysprep-in-windows-2008)
-->
- <Identification>
- <Credentials>
<Domain>northamerica</Domain>
<Username>davidhamilton</Username>
<Password>******</Password>
</Credentials>
<JoinDomain>Redmond.corp.microsoft.com</JoinDomain>
</Identification>
</component>
- <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">
- <!--
By specifying a value of "*" for <ComputerName>, Windows setup will generate a new computer name using a combination of <RegisteredOwner>, <RegisteredOrganization>, and random alphanumeric characters. Since <RegisteredOrganization> is blank, the new computer name will be OsloVPC-*******
-->
<ComputerName>*</ComputerName>
<RegisteredOrganization />
- <!--
The new computer name is generated using a combination of <RegisteredOwner>, <RegisteredOrganization>, and random alphanumeric characters. Since <RegisteredOrganization> is blank, the new computer name will be OsloVPC-*******.
-->
<RegisteredOwner>OsloVPC</RegisteredOwner>
<ShowWindowsLive>false</ShowWindowsLive>
<BluetoothTaskbarIconEnabled>false</BluetoothTaskbarIconEnabled>
- <!--
This setting will copy the profile of the original image to the renamed image when set to true
-->
<CopyProfile>true</CopyProfile>
<DisableAutoDaylightTimeSet>false</DisableAutoDaylightTimeSet>
<DoNotCleanTaskBar>true</DoNotCleanTaskBar>
</component>
</settings>
- <settings pass="generalize">
- <component name="Microsoft-Windows-Security-Licensing-SLC" 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">
<SkipRearm>1</SkipRearm>
</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>
- <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>
</settings>
<cpi:offlineImage cpi:source="catalog:e:/sources/install_windows longhorn serverenterprise.clg" xmlns:cpi="urn:schemas-microsoft-com:cpi" />
</unattend>
- <!--
When the virtual machine is started, Windows setup will:
- Assign the copy a random computer name: "OsloVPC-*****"
- Reset the local Administrators password to pass@word1
- Join the domain specified in the sysprep.xml file (under Microsoft-Windows-UnattendedJoin\Identification\JoinDomain)
- Add the groups/users specified under <DomainAccounts> to the local Administrators and the local Remote Desktop Users group.
Known issues:
- Sysprep removes the Server Manager icon from the Quick Launch toolbar, investigating how to prevent this.
- To start SQL Server Management Studio, either connect to the new server name (OsloVPC-*******) or else connect to ".". The "Server name:" drop-down box in SQL Server Management Studio is pre-populated with "PDC08-CSD" which will not work since the computer name has been changed by sysprep.
- There are some known issues associated with changing the computer name; renaming the computer after everything was installed was not a design, development or test requirement for this milestone.
-->
注释
这些脚本不会修改 Microsoft Office SharePoint Server。 如果你使用的是 Windows SharePoint Services 适配器,将可能需要重新配置 Microsoft Office SharePoint Server,然后更新 HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\BizTalk Server\3.0\TPM 下的 SharePointAdapterManagementGroup 密钥。