How To Stop Running COM+ Processes from Script


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")

    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.


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

ID articol: 304713 - Ultima examinare: 24 mar. 2009 - Revizie: 1