This is not actually something new but for anyone else that wants to quickly have a reference to it, here are two PowerShell scripts to stop and start BizTalk applications.
Stopping a specified Application:
if ($args.count -eq 0) {
"You must specify the BizTalk Application name to stop!"
}
else{
$BTSAppName = $args[0]
$SQLInstance = "."
$BizTalkManagementDb ="BizTalkmgmtdb"
[void] [System.reflection.Assembly]::LoadWithPartialName("Microsoft.BizTalk.ExplorerOM")
$Catalog = New-Object Microsoft.BizTalk.ExplorerOM.BtsCatalogExplorer
$Catalog.ConnectionString = "SERVER=$SQLInstance;DATABASE=$BizTalkManagementDb;Integrated Security=SSPI"
$BTSApp = $Catalog.Applications[$BTSAppName]
if ($BTSApp.Status -ne "stopped")
{
"Stopping" + $BTSApp.Name
$BTSApp.Stop("StopAll")
$catalog.SaveChanges()
}
else
{
$BTSApp.Name + " is already stopped"
}
}
Starting a specified Application:
</pre>
<pre>if ($args.count -eq 0) {
"You must specify the BizTalk Application name to start!"
}
else{
$BTSAppName = $args[0]
$SQLInstance = "."
$BizTalkManagementDb ="BizTalkmgmtdb"
[void] [System.reflection.Assembly]::LoadWithPartialName("Microsoft.BizTalk.ExplorerOM")
$Catalog = New-Object Microsoft.BizTalk.ExplorerOM.BtsCatalogExplorer
$Catalog.ConnectionString = "SERVER=$SQLInstance;DATABASE=$BizTalkManagementDb;Integrated Security=SSPI"
$BTSApp = $Catalog.Applications[$BTSAppName]
if ($BTSApp.Status -ne "started")
{
"Starting " + $BTSApp.Name
$BTSApp.Start("StartAll")
$catalog.SaveChanges()
}
else
{
$BTSApp.Name + " is already started"
}
}

