對 BizTalk Server VHD 進行 Sysprep 處理 (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 金鑰。