How To Stop Running COM+ Processes from Script (304713)



The information in this article 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.

MORE INFORMATION

Step-by-Step Example

  1. 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("ComAdmin.COMAdminCatalog")
        Set oApplications = oCatalog.GetCollection("Applications")
        oApplications.Populate
    
        Wscript.Echo "Closing " & oApplications.Count & " applications."
        For Each oApp In oApplications
            'Must shut down system application last.
            If oApp.Name <> "System Application" Then
    	    Wscript.Echo "Shutting down " & oApp.Name
                Call oCatalog.ShutdownApplication(oApp.Name)
            End If
        Next 'oApp
        Wscript.Echo "Shutting down System Application"
        Call oCatalog.ShutdownApplication("System Application")
        
        Wscript.Echo "Completed shutdown process.  Exiting"
        
        Set oApp = Nothing
        Set oApplications = Nothing
        Set oCatalog = Nothing
    					
  2. In Windows Explorer, double-click Complusstop.vbs to stop all the running COM+ (Dllhost.exe) processes.

REFERENCES

For more information about the COMAdminCatalog object, see the following MSDN Web site:

Modification Type:MinorLast Reviewed:8/30/2004
Keywords:kbCOMPlusCatalog kbhowto KB304713