I’m writing a custom deploy solution for BizTalk. If the application doesn’t exist, I need to call “BTSTask AddApp” to add it.

Sample:


Add-PSSnapIn -Name BiztalkFactory.PowerShell.Extensions

function checkApplicationExists ($appName) 
{
    cd "Biztalk:\Applications"
    $apps = Get-ChildItem
    $boolFoundMatch = $false 
    foreach ($app in $apps) 
      {
         Write-Host "  Testing $($app.Name) " 
         if ($app.Name -eq $appname) 
         {
            $boolFoundMatch = $true 
         }
      }
    return $boolFoundMatch 
  
}

cls
$app1Exists = checkApplicationExists "Test.Vendors"
Write-Host "REI.Vendors $app1Exists" 

$app2Exists = checkApplicationExists "Test.Nonexistent"
Write-Host "REI.Vendor.TestDeploy $app2Exists" 


Filed under: BizTalk AdminPowershellUncategorized