{"id":1288,"date":"2014-05-14T09:03:28","date_gmt":"2014-05-14T07:03:28","guid":{"rendered":"http:\/\/hen.co.za\/blog\/?p=1288"},"modified":"2014-05-14T09:03:28","modified_gmt":"2014-05-14T07:03:28","slug":"start-or-stop-biztalk-applications-using-powershell","status":"publish","type":"post","link":"https:\/\/hen.co.za\/blog\/2014\/05\/start-or-stop-biztalk-applications-using-powershell\/","title":{"rendered":"Start or stop BizTalk Applications using PowerShell"},"content":{"rendered":"<p>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.<\/p>\n<p>Stopping a specified Application:<\/p>\n<pre class=\"brush: powershell; title: ; notranslate\" title=\"\">\r\nif ($args.count -eq 0) {\r\n\u00a0 &quot;You must specify the BizTalk Application name to stop!&quot;\r\n}\r\nelse{\r\n\u00a0\u00a0\u00a0 $BTSAppName = $args&#x5B;0]\r\n\u00a0\u00a0\u00a0 $SQLInstance = &quot;.&quot;\r\n\u00a0\u00a0\u00a0 $BizTalkManagementDb =&quot;BizTalkmgmtdb&quot;\r\n\u00a0\u00a0\u00a0 &#x5B;void] &#x5B;System.reflection.Assembly]::LoadWithPartialName(&quot;Microsoft.BizTalk.ExplorerOM&quot;)\r\n\u00a0\u00a0\u00a0 $Catalog = New-Object Microsoft.BizTalk.ExplorerOM.BtsCatalogExplorer\r\n\u00a0\u00a0\u00a0 $Catalog.ConnectionString = &quot;SERVER=$SQLInstance;DATABASE=$BizTalkManagementDb;Integrated Security=SSPI&quot;\r\n\r\n\u00a0\u00a0\u00a0 $BTSApp = $Catalog.Applications&#x5B;$BTSAppName]\r\n\u00a0\u00a0\u00a0 if ($BTSApp.Status -ne &quot;stopped&quot;)\r\n\u00a0\u00a0\u00a0 {\r\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 &quot;Stopping&quot; + $BTSApp.Name\r\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 $BTSApp.Stop(&quot;StopAll&quot;)\r\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 $catalog.SaveChanges()\r\n\u00a0\u00a0\u00a0 }\r\n\u00a0\u00a0\u00a0 else\r\n\u00a0\u00a0\u00a0 {\r\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 $BTSApp.Name + &quot; is already stopped&quot;\r\n\u00a0\u00a0\u00a0 }\r\n}\r\n<\/pre>\n<p>Starting a specified Application:<\/p>\n<pre class=\"brush: powershell; title: ; notranslate\" title=\"\">&lt;\/pre&gt;\r\n&lt;pre&gt;if ($args.count -eq 0) {\r\n\u00a0 &quot;You must specify the BizTalk Application name to start!&quot;\r\n}\r\nelse{\r\n\u00a0\u00a0\u00a0 $BTSAppName = $args&#x5B;0]\r\n\u00a0\u00a0\u00a0 $SQLInstance = &quot;.&quot;\r\n\u00a0\u00a0\u00a0 $BizTalkManagementDb =&quot;BizTalkmgmtdb&quot;\r\n\u00a0\u00a0\u00a0 &#x5B;void] &#x5B;System.reflection.Assembly]::LoadWithPartialName(&quot;Microsoft.BizTalk.ExplorerOM&quot;)\r\n\u00a0\u00a0\u00a0 $Catalog = New-Object Microsoft.BizTalk.ExplorerOM.BtsCatalogExplorer\r\n\u00a0\u00a0\u00a0 $Catalog.ConnectionString = &quot;SERVER=$SQLInstance;DATABASE=$BizTalkManagementDb;Integrated Security=SSPI&quot;\r\n\r\n\u00a0\u00a0\u00a0 $BTSApp = $Catalog.Applications&#x5B;$BTSAppName]\r\n\u00a0\u00a0\u00a0 if ($BTSApp.Status -ne &quot;started&quot;)\r\n\u00a0\u00a0\u00a0 {\r\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 &quot;Starting &quot; + $BTSApp.Name\r\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 $BTSApp.Start(&quot;StartAll&quot;)\r\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 $catalog.SaveChanges()\r\n\u00a0\u00a0\u00a0 }\r\n\u00a0\u00a0\u00a0 else\r\n\u00a0\u00a0\u00a0 {\r\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 $BTSApp.Name + &quot; is already started&quot;\r\n\u00a0\u00a0\u00a0 }\r\n}\r\n<\/pre>\n","protected":false},"excerpt":{"rendered":"<p>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) { \u00a0 &hellip;<\/p>\n<p class=\"read-more\"><a href=\"https:\/\/hen.co.za\/blog\/2014\/05\/start-or-stop-biztalk-applications-using-powershell\/\">Read more &raquo;<\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[51,16],"tags":[305,280,240],"class_list":["post-1288","post","type-post","status-publish","format-standard","hentry","category-biztalk","category-reference","tag-biztalk","tag-explorerom","tag-powershell"],"_links":{"self":[{"href":"https:\/\/hen.co.za\/blog\/wp-json\/wp\/v2\/posts\/1288","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/hen.co.za\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/hen.co.za\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/hen.co.za\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/hen.co.za\/blog\/wp-json\/wp\/v2\/comments?post=1288"}],"version-history":[{"count":2,"href":"https:\/\/hen.co.za\/blog\/wp-json\/wp\/v2\/posts\/1288\/revisions"}],"predecessor-version":[{"id":1290,"href":"https:\/\/hen.co.za\/blog\/wp-json\/wp\/v2\/posts\/1288\/revisions\/1290"}],"wp:attachment":[{"href":"https:\/\/hen.co.za\/blog\/wp-json\/wp\/v2\/media?parent=1288"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/hen.co.za\/blog\/wp-json\/wp\/v2\/categories?post=1288"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/hen.co.za\/blog\/wp-json\/wp\/v2\/tags?post=1288"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}