Saturday, January 21, 2023

back biztalk apps

     
$exportFolder = "d:\bcp\2023-01-20"
$server = "DBSERVER110"
$database = "BizTalkMgmtDB"

$apps = @(
"App1"
,"App2"
,"App3"
)

$bp="D:\Program Files (x86)\Microsoft BizTalk Server 2013 R2"

foreach ($app in $apps)
    {
        Write-Host "===== Application: $($app) ==== "

        if ($app -ne "BizTalk.System")   # avoid error trying to export this app 
          {
            $fmtDateTime = $(get-date -f yyyy_MM_dd__HH_mm_ss)
            $bindingsDestFilename = "${exportFolder}\$($app).xml" # _$fmtDateTime 
            $msiAppDestFilename = "${exportFolder}\$($app).msi" # _$fmtDateTime

            write-host $bindingsDestFilename
            $allArgs = @("ExportBindings", "/Destination:$bindingsDestFilename",  "/ApplicationName:$($app)"
                "/Server:$server", "/Database:$database")
            if ($app -eq "BizTalk EDI Application")
            {
               #just backup the parties one time with this one app 
               $allArgs += "/GlobalParties"
            }

            write-host "Args=$allArgs"
            & "$bp\BTSTask.exe" $allArgs

            $allArgs = @("ExportApp", "/Package:$msiAppDestFilename",  "/ApplicationName:$($app)",
                "/Server:$server", "/Database:$database")
            write-host "Args=$allArgs"
            & "$bp\BTSTask.exe" $allArgs
          }
    }
    

No comments:

Post a Comment

counter