Sysprep a BizTalk Server VHD (esempio di BizTalk Server)
Sysprep crea uno snapshot di una macchina virtuale con BizTalk Server installato per la distribuzione rapida in altre macchine virtuali.
Prerequisiti
Prima di usare Sysprep, è necessario avere alcune conoscenze sull'uso di macchine virtuali con Hyper-V. È anche necessario disporre di una macchina virtuale con un'installazione pulita, tipica di BizTalk Server e tutti i relativi prerequisiti.
È possibile eseguire Sysprep su Windows Server 2008 e Windows Vista con SP1.
Scopo dell'esempio
Sysprep crea un disco rigido virtuale di un'installazione BizTalk Server (incluso il sistema operativo e tutti i prerequisiti) per la distribuzione rapida in altre macchine virtuali. Un'immagine creata utilizzando Sysprep sceglierà un nuovo nome di computer, in modo da consentire l'aggiunta al dominio al primo avvio. Per consentire l'esecuzione corretta di BizTalk Server, è necessario aggiornare alcune istanze del nome del computer memorizzate nel Registro di sistema e nei database.
In questo documento si presuppone che BizTalk Server sia configurato per l'esecuzione in un singolo computer e viene mostrato come aggiornare altre istanze del nome del computer, specificando il nuovo nome.
Percorso dell'esempio
L'esempio è disponibile nel seguente percorso dell'SDK:
< Percorso> esempi\Amministrazione\Sysprep\
Nella seguente tabella sono riportati i file inclusi nell'esempio e ne viene descritto lo scopo.
Nota
I file con estensione vbs e cmd indicati nella tabella seguente sono tutti automatizzati nei file di risposte Sysprep, ovvero Sysprep.xml w SetupCompletecmd.txt, e sono inclusi nell'elenco solo come riferimento. Se risulta necessario eseguire manualmente tali script, eseguirli nell'ordine indicato nella tabella.
File | Descrizione |
---|---|
Sysprep.xml | File di risposte |
SetupCompletecmd.txt | File di risposte |
ReplaceMachineName.vbs | Scopo: apre un file e sostituisce tutte le istanze di una determinata stringa con il nome del computer corrente. Risulta utile per preparare gli altri file di script e xml e per aggiornare bm.exe.config. Utilizzo: ReplaceMachineName.vbs <file per aprire><la stringa da sostituire> |
UpdateRegistry.vbs | Scopo: Aggiornamenti il nome del computer archiviato nelle impostazioni del Registro di sistema BizTalk. Utilizzo: UpdateRegistry.vbsUpdateInfo.xml<>. Assicurarsi di sostituire tutte le istanze di $(VECCHIONOMECOMPUTER) e $(NUOVONOMECOMPUTER) in questo file xml. |
UpdateDatabase.vbs | Scopo: Aggiornamenti il nome del computer archiviato nei database di Gestione BizTalk. Utilizzo: UpdateDatabase.vbsUpdateInfo.xml<> |
UpdateBAMDb.vbs | Scopo: Aggiornamenti il nome del computer archiviato nei database BAM. Utilizzo: UpdateBamDb.vbsUpdateInfo.xml<> |
UpdateSSO.cmd | Scopo: riconfigura il server segreto SSO (Enterprise Single Sign-On). Utilizzo:UpdateInfo.xmlsso.cmd <> |
UpdateSqlServerAndInstanceName.cmd | Scopo: riconfigura SQL e SQL Express, riavvia una serie di servizi dipendenti e reregisters BAMAlerts. Utilizzo: modificare lo script e sostituire tutte le istanze di $(NEWCOMPUTERNAME) e aggiornare il serviceusername e servicepassword per gli avvisi BAM. Eseguire quindi UpdateSqlServerAndInstanceName.cmd passando il vecchio nome del computer come primo argomento. |
Creazione dei file di risposte ed esecuzione di Sysprep
Per creare i file di risposte
Installare e configurare BizTalk Server in una macchina virtuale. Assicurarsi di utilizzare le opzioni predefinite di installazione e configurazione, poiché Sysprep non supporta le installazioni personalizzate.
Copiare il contenuto della cartella “scripts” inclusa nel percorso C:\Scripts sulla macchina virtuale.
Preparare un file di risposta sysprep modificando le righe seguenti in Sysprep.xml. Nota: queste righe sono contrassegnate con un "!" prima di esse. È possibile usarli come modello oppure eseguire una copia personalizzata e copiata nella <sezione FirstLogonCommands> .
Sostituire $(VECCHIONOMECOMPUTER) con il nome di computer attuale della macchina virtuale.
Account utente
Password
È necessario aggiornare anche eventuali dettagli aziendali nei file UpdateSqlServerAndInstance.cmd e Sysprep.xml.
In alternativa, è possibile creare un file di risposta Sysprep da zero usando l'AIK (Automated Installation Kit) in Windows Server 2008. Assicurarsi che la <sezione FirstLogonCommands> corrisponda agli esempi in modo che gli script BizTalk vengano eseguiti nel primo avvio.
Per eseguire Sysprep
Aprire una finestra del prompt dei comandi ed eseguire Sysprep. Il comando avrà un aspetto analogo al seguente:
C:\windows\system32\sysprep\sysprep.exe /oobe /generalize /shutdown /unattend:c:\scripts\unattend_Win2K8x64.xml
Per l'esecuzione di Sysprep è necessaria circa mezz'ora. Al termine dell'esecuzione, la macchina virtuale verrà arrestata automaticamente.
Dopo l'arresto della macchina virtuale, unire eventuali snapshot, quindi copiare il file VHD in un percorso sicuro.
Il file VHD è ora pronto per la distribuzione in altre macchine virtuali e include il sistema operativo, BizTalk Server e tutti i prerequisiti.
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.
-->
Commenti
Questi script non modificano Microsoft Office SharePoint Server. Se si utilizza l'adapter Windows SharePoint Services, sarà probabilmente necessario riconfigurare Microsoft Office SharePoint Server, quindi aggiornare la chiave SharePointAdapterManagementGroup in HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\BizTalk Server\3.0\TPM.