我已经完成了自动执行一些先决条件安装的任务,每次我们创建一个新的空白虚拟机时,都需要完成这些安装,以便在内部软件中进行测试/查找错误。
主要项目是:
我发现我可以使用它在第一次运行时创建的配置脚本很好地自动化SQL服务器,并且还发现了一些从命令行安装具有所需功能的IIS的详细信息,但是遇到了biztalk的问题。
Biztalk的版本是2009年,我只需要安装“附加软件”下的“业务规则组件”。我搜索过网络,所有指南似乎都指的是自动配置biztalk,而不是实际安装。
有没有人知道如何获取biztalk post install的配置文件,或者生成一个纯粹安装我需要的一个组件?
我的计划是基本上只使用powershell一个接一个地调用每个安装程序,并依次启动它们的相关配置文件,因为这似乎是最简单的解决方案。
答案 0 :(得分:7)
安装BizTalk无人值守非常容易。首先在“参考”计算机上安装BizTalk,其中包含您期望的所有选项,然后生成在其他计算机上安装时提供的“模板”文件。这是我为此而写的脚本的一部分:
$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
Create-Unattended-Install-Config-File使用从参考机器导出配置时生成的XML文件,并为要安装BizTalk的系统“自定义”它(替换数据库,实例,密码等等)与实际值一起):
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
}
最后,Configure-BizTalk函数使用相同的配置文件来实际创建BizTalk数据库,配置ENTSSO等等:
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"
}
当然你不能“按原样”使用上面的代码,但我希望它可以让你大致了解如何继续。