Automated/silent install of Biztalk via powershell
I have been given the task of automating some pre-requisite installs that need to be done each time we create a new blank virtual machine to roll out in house software out on for testing/bug finding.
The main items are:
- SQL server 2008 R2
- Biztalk
- IIS
I have found I can automate SQL server quite well with a configuration script it creates the first time you run it, and also found some details for installing IIS with required features from command line however am having trouble with biztalk.
The version of Biztalk concerned is 2009 and I only need to install the 'business rules components' found under 'additional software'. I have searched the net and all guides seem to be refering to automating the configuration of biztalk and not the actual install.
Does anyone know of a way to pickup a configuration file for biztalk post install or generate one purely to install the one component I need silently?
My plan is to then essentially just use powershell to call each installer one after the other and launch them with their associated configuration files one after the other as this 开发者_如何学编程seems to be the simplest solution.
Installing BizTalk unattended is quite easy. You first install BizTalk on a "reference" machine with all the options you are expecting, then you generate a "template" file that you provide when installing on other machines. Here is part of a script I wrote for just doing that:
$bizTalkFeatureFile = (Create-Unattended-Install-Config-File $global:RootInstallDir)
$bizTalkLogFile = $global:LogPath + "\BizTalkInstall_" + $(Get-Date).ToString("yyyy-MM-dd_HH_mm") + ".log"
$ExitCode = 0
Log-Info "`t`t$($MyInvocation.InvocationName): Starting unattended BizTalk installation from features file: $bizTalkFeatureFile"
if ($Is32bit) { $ExitCode = (Launch-Process "$global:BizTalkInstallDir\setup" "/CABPATH $bizTalkRunTimeDir\BTSRedistW2K8EN32.cab /S $bizTalkFeatureFile /L $bizTalkLogFile") }
if ($Is64bit) { $ExitCode = (Launch-Process "$global:BizTalkInstallDir\setup" "/CABPATH $bizTalkRunTimeDir\BTSRedistW2K8EN64.cab /S $bizTalkFeatureFile /L $bizTalkLogFile") }
if ($ExitCode -ne 0)
{ throw "BizTalk installation failed. See $BizTalkLogFile content" }
Log-Info "`t`t$($MyInvocation.InvocationName): BizTalk features installed"
Configure-BizTalk $bizTalkFeatureFile $bizTalkLogFile
The Create-Unattended-Install-Config-File use the XML file generated when exporting your configuration from your reference machine and "customize" it for the system on which you want to install BizTalk (replacing database, instance, passwords and so on with the actual values):
function Create-Unattended-Install-Config-File
{
param (
[parameter(Mandatory = $true)][string] $baseDir
)
Log-Info "`t`t$($MyInvocation.InvocationName): Creating unattended installation configuration file"
try
{
$Error.Clear()
if ($Is64bit)
{ $bizTalkFeatureFileTemplate = $baseDir + "\ConfigFiles\Templates\BizTalk64HealthLink_Template.xml" }
else { $bizTalkFeatureFileTemplate = $baseDir + "\ConfigFiles\Templates\BizTalkHealthLink_Template.xml" }
$bizTalkFeatureFile = $baseDir + "\ConfigFiles\BizTalk_HealthLink.xml"
if (Test-Path $bizTalkFeatureFile)
{ Remove-Item $bizTalkFeatureFile }
Copy-Item $bizTalkFeatureFileTemplate $bizTalkFeatureFile
$Domain = (Get-Domain-Name)
Replace-Word $bizTalkFeatureFile "@@DatabaseServer@@" $DatabaseServer
Replace-Word $bizTalkFeatureFile "@@INSTANCENAME@@" $INSTANCENAME
Replace-Word $bizTalkFeatureFile "@@HealthLinkUser@@" $HealthLinkUser
Replace-Word $bizTalkFeatureFile "@@Password@@" $Password
Replace-Word $bizTalkFeatureFile "@@Domain@@" $Domain
Replace-Word $bizTalkFeatureFile "@@SSOAdministrators@@" $SSOAdministrators
Replace-Word $bizTalkFeatureFile "@@SSOAffiliateAdministrators@@" $SSOAffiliateAdministrators
Replace-Word $bizTalkFeatureFile "@@BizTalkServerAdministrators@@" $BizTalkServerAdministrators
Replace-Word $bizTalkFeatureFile "@@BizTalkServerOperators@@" $BizTalkServerOperators
Replace-Word $bizTalkFeatureFile "@@BizTalkApplicationUsers@@" $BizTalkApplicationUsers
Replace-Word $bizTalkFeatureFile "@@BizTalkIsolatedHostUsers@@" $BizTalkIsolatedHostUsers
Replace-Word $bizTalkFeatureFile "@@SSO_ID_BACKUP_SECRET_FILE@@" $SSO_ID_BACKUP_SECRET_FILE
Replace-Word $bizTalkFeatureFile "@@SSO_ID_BACKUP_SECRET_PASSWORD@@" $SSO_ID_BACKUP_SECRET_PASSWORD
Replace-Word $bizTalkFeatureFile "@@SSO_ID_BACKUP_SECRET_PASSWORD_CONFIRM@@" $SSO_ID_BACKUP_SECRET_PASSWORD_CONFIRM
Replace-Word $bizTalkFeatureFile "@@SSO_ID_BACKUP_SECRET_REMINDER@@" $SSO_ID_BACKUP_SECRET_REMINDER
}
catch
{
Log-Error "`t`t$($MyInvocation.InvocationName): $_"
}
Log-Info "`t`t$($MyInvocation.InvocationName): Configuration file created ($sqlConfigFile)"
return $bizTalkFeatureFile
}
Finally, the Configure-BizTalk function use the same configuration file to actually create the BizTalk databases, configure ENTSSO, and so on:
function Configure-BizTalk
{
param (
[parameter(Mandatory = $true)][string] $bizTalkFeatureFile,
[parameter(Mandatory = $true)][string] $bizTalkLogFile
)
Log-Info "`t`t$($MyInvocation.InvocationName): Configuring BizTalk from features file: $bizTalkFeatureFile"
try
{
$Error.Clear()
$ExitCode = 0
$ExitCode = (Launch-Process "$global:ProgramFiles32\Microsoft BizTalk Server 2009\Configuration.exe" "/s `"$bizTalkFeatureFile`" /l `"$bizTalkLogFile`"")
if ($ExitCode -ne 0)
{ throw "BizTalk configuration failed. See $bizTalkLogFile content" }
}
catch
{
Log-Error "`t`t$($MyInvocation.InvocationName): $_"
}
Log-Info "`t`t$($MyInvocation.InvocationName): BizTalk configured"
}
Of course you cannot use the code above "as-is" but I hope it can give you a general idea of how to proceed.
精彩评论