通过 powershell 自动/静默安装 Biztalk

发布于 2024-12-03 16:56:20 字数 488 浏览 0 评论 0原文

我的任务是自动化一些先决条件的安装,每次我们创建一个新的空白虚拟机以推出内部软件以进行测试/错误查找时都需要完成这些安装。

主要项目有:

  • SQL Server 2008 R2
  • Biztalk
  • IIS

我发现我可以使用第一次运行它时创建的配置脚本很好地自动化 SQL Server,并且还找到了一些从命令行安装具有所需功能的 IIS 的详细信息,但是我biztalk 遇到问题。

涉及的Biztalk版本是2009,我只需要安装“附加软件”下的“业务规则组件”。我在网上搜索过,所有指南似乎都指的是 biztalk 的自动化配置,而不是实际的安装。

有谁知道一种方法来获取 biztalk 安装后的配置文件或生成一个纯粹用于默默安装我需要的组件的方法?

我的计划是基本上只使用 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.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

强辩 2024-12-10 16:56:20

无人值守安装 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"

}

当然你不能“按原样”使用上面的代码,但我希望它能让您大致了解如何继续。

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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文