Howto determine if a .dll is registered

Discussion in 'Scripting' started by [email protected], Apr 11, 2006.

  1. I need to write a script (or VB app) to check the install/config status of an
    application, one requirement of which is to determine if a specific .dll file
    is properly registered.

    What is the best (not necessarily easiest) way to programatically determine
    if a dll is registered?

    Thanks,
    Mike
     
    [email protected], Apr 11, 2006
    #1
    1. Advertisements

  2. MikeS@MLS

    Marty List Guest

    I don't know of any methods or functions to call for this, but if you want to do
    it manually this might help.

    First you need to know the name of the object you are looking for (you might
    have to search the registry for this). Using "C:\WINDOWS\System32\wshom.ocx" as
    an example (same thing for OCX/DLL) then you would search the registry under
    HKEY_CLASSES_ROOT and find out that "WScript.Network" is the name to look for.

    Your script would read the CLSID (a.k.a. GUID a.k.a globally unique identifier)
    from this key:
    HKEY_CLASSES_ROOT\WScript.Network\CLSID

    - Then use the CLSID to find the actual code here:
    HKEY_CLASSES_ROOT\CLSID\{093FF999-1EA0-4079-9525-9614C3504B74}

    - The file path is stored here:
    HKEY_CLASSES_ROOT\CLSID\{093FF999-1EA0-4079-9525-9614C3504B74}\InProcServer­32


    Keep in mind there can be different versions referenced (ie: WScript.Network.1,
    WScript.Network.2), but the current version should be listed without a number at
    the end (WScript.Network)
     
    Marty List, Apr 11, 2006
    #2
    1. Advertisements

  3. Thanks Marty. That got me pointed in the right direction. With what you
    showed me, I created the following snippit that loads all the registered
    ..dlls into a listbox called ListBox1:

    -----------------------------------------------------------------------------
    Dim Catalog As COMAdmin.COMAdminCatalog
    Dim Applications As COMAdmin.COMAdminCatalogCollection
    Dim AppObject As COMAdmin.COMAdminCatalogObject

    Catalog = CreateObject("COMAdmin.COMAdminCatalog")

    ' Get the Applications collection and populate it.
    Applications = Catalog.GetCollection("InprocServers")
    Applications.Populate()

    ' Loop through the collection and populate the list box.
    For Each AppObject In Applications
    ListBox1.Items.Add(AppObject.Name)
    Next
    ---------------------------------------------------------------------------------
    If you know what Name you're looking for, you can then search the list. I
    found the name (IIS.PwChg) by looking through the registry using your
    suggestion.

    A couple of points, though:

    1. It takes a bit of time to run - I put a messagebox at the end to let me
    know when the process is complete.

    2. The collection name is case sensitive. I found out the hard way that
    "InProcServers" is NOT the same as "InprocServers" (the latter being how it
    is listed in MSDN).

    Thanks a bunch for the help!

    Mike
     
    [email protected], Apr 11, 2006
    #3
  4. MikeS@MLS

    Marty List Guest

    I've never used "COMAdmin.COMAdminCatalog" before. I'm sure that will be useful
    to me at some point, thanks for posting the follow-up.
     
    Marty List, Apr 12, 2006
    #4
    1. Advertisements

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.