2011-09-07 26 views
2

我已經被賦予了自動化一些必要的安裝任務,每次我們創建一個新的空白虛擬機來推出內部軟件進行測試/ bug發現。通過powershell自動/無提示安裝Biztalk

主要項目有:

  • SQL服務器2008 R2
  • Biztalk的
  • IIS

我發現我可以用配置腳本自動SQL服務器相當不錯它創建的第一次運行它時,還發現了一些有關從命令行安裝具有所需功能的IIS的詳細信息,但是在使用biztalk時遇到了問題。

有關Biztalk的版本是2009年,我只需要安裝'其他軟件'下的'業務規則組件'。我搜索了網絡,所有的指南似乎都指的是自動化biztalk的配置,而不是實際的安裝。

有誰知道一種方法來獲取配置文件的biztalk後安裝或生成一個純粹安裝我需要靜默的一個組件?

我的計劃是基本上只是使用powershell逐個調用每個安裝程序,並逐個啓動它們的相關配置文件,因爲這似乎是最簡單的解決方案。

回答

6

無人值守安裝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 

的創建,無人值守安裝,配置文件中使用來自參考機導出的配置時,和「定製」,它的生成的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 "@@[email protected]@" $DatabaseServer 
     Replace-Word $bizTalkFeatureFile "@@[email protected]@" $INSTANCENAME 
     Replace-Word $bizTalkFeatureFile "@@[email protected]@" $HealthLinkUser 
     Replace-Word $bizTalkFeatureFile "@@[email protected]@" $Password 
     Replace-Word $bizTalkFeatureFile "@@[email protected]@" $Domain 

     Replace-Word $bizTalkFeatureFile "@@[email protected]@" $SSOAdministrators 
     Replace-Word $bizTalkFeatureFile "@@[email protected]@" $SSOAffiliateAdministrators 
     Replace-Word $bizTalkFeatureFile "@@[email protected]@" $BizTalkServerAdministrators 
     Replace-Word $bizTalkFeatureFile "@@BizTalkServerOpera[email protected]@" $BizTalkServerOperators 
     Replace-Word $bizTalkFeatureFile "@@[email protected]@" $BizTalkApplicationUsers 
     Replace-Word $bizTalkFeatureFile "@@[email protected]@" $BizTalkIsolatedHostUsers 

     Replace-Word $bizTalkFeatureFile "@@[email protected]@" $SSO_ID_BACKUP_SECRET_FILE 
     Replace-Word $bizTalkFeatureFile "@@[email protected]@" $SSO_ID_BACKUP_SECRET_PASSWORD 
     Replace-Word $bizTalkFeatureFile "@@[email protected]@" $SSO_ID_BACKUP_SECRET_PASSWORD_CONFIRM 
     Replace-Word $bizTalkFeatureFile "@@[email protected]@" $SSO_ID_BACKUP_SECRET_REMINDER 
    } 

    catch 
    { 
     Log-Error "`t`t$($MyInvocation.InvocationName): $_" 
    } 

    Log-Info "`t`t$($MyInvocation.InvocationName): Configuration file created ($sqlConfigFile)" 

    return $bizTalkFeatureFile 
} 

最後,配置-的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" 

}

當然你也可以不使用上面的代碼「原樣」但我希望它可以給你如何進行一個大致的瞭解。