Ravindar, Biztalk Developer and Administrator

Just another BizTalk blog

Disable all artifacts of a particular Biztalk application using powershell

the following code disables all recieve locations for a particular specified BizTalk application named “MyBizApp”

Function Invoke-BizTalkEOM
{
$BizTalkConnectionString = "SERVER=.;DATABASE=BizTalkMgmtDb;Integrated Security=SSPI"
if ( ( Test-Path "HKLM:SOFTWARE\Microsoft\Biztalk Server\3.0\Administration" ) -eq $true )
 {
 $BizTalkMgmtDBServer = ( Get-ItemProperty "HKLM:SOFTWARE\Microsoft\Biztalk Server\3.0\Administration" ).MgmtDBServer
 $BizTalkMgmtDBName = ( Get-ItemProperty "HKLM:SOFTWARE\Microsoft\Biztalk Server\3.0\Administration" ).MgmtDBName
 $BizTalkConnectionString = "SERVER=$BizTalkMgmtDBServer;DATABASE=$BizTalkMgmtDBName;Integrated Security=SSPI"
 }
$BizTalkCatalogExplorer = New-Object Microsoft.BizTalk.ExplorerOM.BtsCatalogExplorer
$BizTalkCatalogExplorer.ConnectionString = $BizTalkConnectionString
return $BizTalkCatalogExplorer
}
$BizTalkCatalogExplorer = Invoke-BizTalkEOM
$name="MyBizApp"
 $BizTalkApplication = $BizTalkCatalogExplorer.Applications[$name]
 $BizTalkApplication.Stop([Microsoft.BizTalk.ExplorerOM.ApplicationStopOption] ("DisableAllReceiveLocations"))
$BizTalkCatalogExplorer.SaveChanges()

if you want to disable other artifacts also, you can add parameters like below

$BizTalkApplication.Stop([Microsoft.BizTalk.ExplorerOM.ApplicationStopOption] ("DisableAllReceiveLocations","UnenlistAllOrchestrations","UnenlistAllSendPortGroups","UnenlistAllSendPorts","UndeployAllPolicies"))
Advertisements

July 5, 2013 - Posted by | Powershell with Biztalk

No comments yet.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: