none
Check whether aplication in COMAdmin.COMAdminCatalog is running or not RRS feed

  • Question

  • Hi,

    We have some applications running in COMAdmin Catalog.

    We need to check whether the application is in STOPPED state or not.If the application is in STOPPED state we need to start it.

    Could you please help us with the command to check the state of the application.

    We have worked the below, however not sure how to identify the current state of the service Step App and Step Common.

    set oCatalog1= CreateObject("COMAdmin.COMAdminCatalog")

    er4=oCatalog1.StartApplication("STeP Apps")
    End If
    WScript.sleep 1000

    er5=oCatalog1.StartApplication("STeP Common") 'case sensitive
    End If
    set oCatalog1= nothing

    Thanks,

    Nithya

    Friday, August 12, 2016 6:37 AM

Answers

  • Here's a short VBScript sample that outputs the COM+ application name, ID, and whether it is running.


    Dim Catalog, AppCollection, AppList, AppItem
    Set Catalog = CreateObject("COMAdmin.COMAdminCatalog")
    Set AppCollection = Catalog.GetCollection("Applications")
    AppCollection.Populate
    Set AppList = CreateObject("Scripting.Dictionary")
    For Each AppItem In AppCollection
      AppList.Add AppItem.Value("ID"), AppItem.Name
    Next
    
    Dim AppInstances, AppInstance, AppInstanceList, Value
    Set AppInstances = Catalog.GetCollection("ApplicationInstances")
    AppInstances.Populate
    Set AppInstanceList = CreateObject("Scripting.Dictionary")
    For Each AppInstance In AppInstances
      Value = AppInstance.Value("Application")
      AppInstanceList.Add Value, AppList(Value)
    Next
    
    For Each AppItem In AppList
      WScript.Echo vbNewLine _
        & "App Name: " & vbTab & AppList(AppItem) & vbNewLine _
        & "App ID: " & vbTab & AppItem & vbNewLine _
        & "Running? " & vbTab & CStr(AppInstanceList.Exists(AppItem))
    Next
    


    -- Bill Stewart [Bill_Stewart]



    Thursday, August 18, 2016 4:00 PM
    Moderator

All replies

  • You searched before asking, right?


    -- Bill Stewart [Bill_Stewart]

    Friday, August 12, 2016 2:03 PM
    Moderator
  • we checked. Please share vb code to check service running status. eg: if ApplicationName is enabled (running) then get pop up like "Enabled", if its not under running then message pop up should come like "disabled".

    I tried below script. Please advise.

    '' Setup variables
    Const ApplicationName = "APP NAME"

    'Const AccountName = "NT AUTHORITY\NETWORK SERVICE"
     
    '' Setup COM+ Application Catalog Object
    Set Catalog = CreateObject("COMAdmin.COMAdminCatalog")
    Set apps = Catalog.GetCollection("Applications")
    ''Populate the object with Applications from the COM Admin Catalog object
    apps.populate
     
    '' Loop for each application in the array
    For each app in apps
    '' Check for my application
        If app.Name = ApplicationName then
     if app.Activation("ApplicationAccessChecksEnabled")=false then
     msgbox "disabled"
     catalog.StartApplication(ApplicationName)
     else
     msgbox "enabled"
     End If  
        End If
    '' Progress the application loop
    Next

    Wednesday, August 17, 2016 7:21 AM
  • Advise about what?

    -- Bill Stewart [Bill_Stewart]

    Wednesday, August 17, 2016 12:17 PM
    Moderator
  • The above script is not working as expected.

    Please help me to find script as per below requirement.

    If Application_Component_service = disabled_status

    then "get alert" and make it run

    Else

    get alert "running"

    Thursday, August 18, 2016 2:56 AM
  • COM+ Server Applications running as a Service can start/stop/pause/recycle.  These services are used with larger packages like IIS, SharePoint and Exchange.

    Each subsystem usually supplies a tool for managing the COM servers running as a service.  Check with the vendor of the package for instructions on managing the server instance.

    The most often reason for this kind of question is a system message stating that the COM+ service has stopped.  This may be normal.  Most apps are set to "start" with the system but they will stop if no work is to be performed.  If an app is hung it may need to be recycled.  COM servers can be set to automatically restart or recycle when there is an issue.  Check with the vendor for how to manage this.

    IIS and SharePoint have a command line utility to manage this.  Normally no management is needed except when a badly designed custom server crashes or hangs.   If this is happening then you must contact the vendor for a remedy.


    \_(ツ)_/

    Thursday, August 18, 2016 3:20 PM
  • Here's a short VBScript sample that outputs the COM+ application name, ID, and whether it is running.


    Dim Catalog, AppCollection, AppList, AppItem
    Set Catalog = CreateObject("COMAdmin.COMAdminCatalog")
    Set AppCollection = Catalog.GetCollection("Applications")
    AppCollection.Populate
    Set AppList = CreateObject("Scripting.Dictionary")
    For Each AppItem In AppCollection
      AppList.Add AppItem.Value("ID"), AppItem.Name
    Next
    
    Dim AppInstances, AppInstance, AppInstanceList, Value
    Set AppInstances = Catalog.GetCollection("ApplicationInstances")
    AppInstances.Populate
    Set AppInstanceList = CreateObject("Scripting.Dictionary")
    For Each AppInstance In AppInstances
      Value = AppInstance.Value("Application")
      AppInstanceList.Add Value, AppList(Value)
    Next
    
    For Each AppItem In AppList
      WScript.Echo vbNewLine _
        & "App Name: " & vbTab & AppList(AppItem) & vbNewLine _
        & "App ID: " & vbTab & AppItem & vbNewLine _
        & "Running? " & vbTab & CStr(AppInstanceList.Exists(AppItem))
    Next
    


    -- Bill Stewart [Bill_Stewart]



    Thursday, August 18, 2016 4:00 PM
    Moderator
  • Somewhat shorter way of saying basically the same thing in PowerShell:


    $catalog = New-Object -ComObject "COMAdmin.COMAdminCatalog"
    
    $appCollection = $catalog.GetCollection("Applications")
    $appCollection.Populate()
    $appList = @{}
    $appCollection | ForEach-Object {
      $appList.Add($_.Value("ID"), $_.Name)
    }
    
    $appInstances = $catalog.GetCollection("ApplicationInstances")
    $appInstances.Populate()
    $appInstanceList = @{}
    $appInstances | ForEach-Object {
      $appValue = $_.Value("Application")
      $appInstanceList.Add($appValue, $appList[$appValue])
    }
    
    $appList.Keys | ForEach-Object {
      New-Object PSObject -Property @{
        "Name"    = $appList[$_]
        "ID"      = $_
        "Running" = $appInstanceList.ContainsKey($_)
      }
    }


    -- Bill Stewart [Bill_Stewart]

    Thursday, August 18, 2016 5:23 PM
    Moderator