Search code examples
vbscriptcom+

Named Values of the ICatalogObject


I am trying to interogate the values of the ICatalogObject object using VBScript. When I look at a COM+ object's properties in COM Services Explorer, I can see properies such as 'Name', 'Description', 'DLL', etc as depicted below). I am assuming (perhaps incorreclty so) that these are exposed via the Value property collection as named properties. My problem is that I am struggling finding a list of what the actual names of these named properties are. You cannot call Value without specifying a property name -- and I am yet to find a concise list of named properties. I have tried to use the names referenced on the captions on the screenshot, but to no avail. Is there a list somewhere of these Named Values, or can I retrieve a collection of Value Names somehow?

I have been able to deterime that the following return values: Deleteable, Description

sample code:

Dim appName
appName = WScript.Arguments.Item(0)
Dim catalog, apps, app
Set catalog = CreateObject("COMAdmin.COMAdminCatalog")
Set apps = catalog.GetCollection("Applications")
apps.Populate
For each app in apps
if app.Name = appName then
    if app.Value("DLL") = "C:\temp\MyDll.dll" then
        'code to do something -- however I don't know what the named property 
        'that contains the DLL file location is called.
    end if 
end if    
Next

Image of some of the properties I want -- ie: DLL enter image description here


Solution

  • I agree -- it's hard to find the documentation. The property you are interested in (DLL) is on the component level and not on the application level. You can find the list of properties for the components here. At the bottom of COMAdminCatalogObject you can find an example for retrieving the components.

    A sample would look something like:

    Dim appName
    appName = WScript.Arguments.Item(0)
    Dim catalog, apps, app
    Set catalog = CreateObject("COMAdmin.COMAdminCatalog")
    Set apps = catalog.GetCollection("Applications")
    apps.Populate
    For each app in apps
    
      if app.Name = appName then
        WScript.Echo "Processing Application " & app.Name
    
        Dim Components
        Set Components = apps.GetCollection("Components", app.Key) 
        Components.Populate
    
        Dim CompObject
        For Each CompObject in Components 
          Wscript.echo "  Component " & CompObject.Name & " is in DLL " & CompObject.Value("DLL")
        Next 
      end if    
    Next