locked
vbscript to access "run always" status in component services RRS feed

  • Question

  • Hi,

     Iam trying to query the "Run always" Coloum ofCompenet services to see if its "Yes" or "No"  for COM application.

    iam not sure how access this colum using vbscript. I tried with below script but its not giving status

    any help is apprecaited.

    ----

    Dim objCatalog
    Dim objAppCollection
    Dim objApp
    Dim objComCollection
    Dim objCom
    Dim objPropertyCollection
    Dim objProperty

    Set objCatalog = CreateObject("COMAdmin.COMAdminCatalog")
    Set objAppCollection = objCatalog.GetCollection("Applications")
    objAppCollection.Populate

    For Each objApp in objAppCollection
        If objApp.Name = "System Application" Then
         WScript.Echo objApp.Name & " " & objApp.Key
     WScript.Echo objApp.status
      End If
    Next

    Monday, April 23, 2012 4:36 AM

Answers

  • Hi,

     Iam trying to query the "Run always" Coloum ofCompenet services to see if its "Yes" or "No"  for COM application.

    iam not sure how access this colum using vbscript. I tried with below script but its not giving status

    any help is apprecaited.

    ----

    Dim objCatalog
    Dim objAppCollection
    Dim objApp
    Dim objComCollection
    Dim objCom
    Dim objPropertyCollection
    Dim objProperty

    Set objCatalog = CreateObject("COMAdmin.COMAdminCatalog")
    Set objAppCollection = objCatalog.GetCollection("Applications")
    objAppCollection.Populate

    For Each objApp in objAppCollection
        If objApp.Name = "System Application" Then
         WScript.Echo objApp.Name & " " & objApp.Key
     WScript.Echo objApp.status
      End If
    Next

    There is no status on an objects key.  You have to return the object to get its status.

    Dim objCatalog 'As COMAdminCatalog
    Set objCatalog = CreateObject("COMAdmin.COMAdminCatalog")
    objCatalog.Connect "localhost"
    Dim objApplicationsColl 'As COMAdminCatalogCollection
    Set objApplicationsColl = objCatalog.GetCollection("Applications")
    objApplicationsColl.Populate
    For Each objApp In objApplicationsColl
        If objApp.Value("Activation") = 0 Then
            DispString = "(INPROC)"
        Else
            DispString = "(LOCAL)"
        End If
        WScript.Echo objApp.Name & DispString & " " & objApp.Key
        Set Components = objApplicationsColl.GetCollection("Components", objApp.Key)
        On Error Resume Next
        Components.Populate
        If Err Then
            WScript.Echo  ">>>>>>>>>>>>Invalid Populate call"
            On Error GoTo 0
        Else
            On Error GoTo 0
            For Each CompObject In Components
                 WScript.Echo  vbTab & CompObject.Name & " " & CompObject.Key
            Next
        End If
    Next


    ¯\_(ツ)_/¯


    • Edited by jrv Monday, April 23, 2012 10:34 AM
    • Proposed as answer by Richard MuellerMVP Wednesday, April 25, 2012 9:46 PM
    • Marked as answer by Bill_Stewart Friday, April 27, 2012 2:10 PM
    Monday, April 23, 2012 9:56 AM