Microsoft KB Archive/304713

= How To Stop Running COM+ Processes from Script =

Article ID: 304713

Article Last Modified on 12/5/2007

-

APPLIES TO


 * Microsoft COM+ 1.0
 * Microsoft COM+ 1.5

-



This article was previously published under Q304713



SUMMARY
In Microsoft Windows NT 4.0, you can run MTXSTOP from a command prompt to stop all of the running Mtx.exe processes. Although an equivalent command is not available in COM+, this article describes how to create script that stops all of the running COM+ processes.



Step-by-Step Example
  In Notepad, create a new script file named Complusstop.vbs, and paste the following code: Dim oApplications 'As COMAdminCatalogCollection Dim oCatalog 'As COMAdminCatalog Dim oApp 'As COMAdminCatalogObject Set oCatalog = CreateObject(&quot;ComAdmin.COMAdminCatalog&quot;) Set oApplications = oCatalog.GetCollection(&quot;Applications&quot;) oApplications.Populate

Wscript.Echo &quot;Closing &quot; & oApplications.Count & &quot; applications.&quot; For Each oApp In oApplications 'Must shut down system application last. If oApp.Name <> &quot;System Application&quot; Then Wscript.Echo &quot;Shutting down &quot; & oApp.Name Call oCatalog.ShutdownApplication(oApp.Name) End If   Next 'oApp Wscript.Echo &quot;Shutting down System Application&quot; Call oCatalog.ShutdownApplication(&quot;System Application&quot;) Wscript.Echo &quot;Completed shutdown process. Exiting&quot; Set oApp = Nothing Set oApplications = Nothing Set oCatalog = Nothing  In Windows Explorer, double-click Complusstop.vbs to stop all the running COM+ (Dllhost.exe) processes.

