Search code examples
windowsperlvbscriptjscriptcom+

How to programmatically set COM+ Component -> Transactions to Not Supported?


I am looking for a solution to programmatically modify Com+ Component Property -> Transaction Support to “Not Supported”

The manual steps are the following:

  1. Open Component Services dialog (comexp.msc)
  2. Expand Component Services -> Computers -> My Computer
  3. Find and expand COM+ QC Dead Letter Queue Listener
  4. Expand folder Components inside the opened component
  5. Find component QC.DLQListener and open context menu for this component and select properties
  6. On the Properties screen, select “Transactions” tab and set Transactions Support to Not Supported
  7. Click “OK” to Save the changes

enter image description here


Solution

  • After I spent several hours on this problem, I've finally got a solution on C#.

    I've got a huge insight from the following articles:

    using System;
    using System.Collections.Generic;
    using System.Linq;
    using System.Text;
    using COMAdmin;
    
    namespace SetComPlusTransactionsToNotRequired
    {
        class Program
        {
            static void Main(string[] args)
            {
                COMAdminCatalog catalog;
                COMAdminCatalogCollection applications;
    
                // Get the catalog
                catalog = new COMAdminCatalog();
    
                // Get the list of all COM+ applications contained within this catalog
                applications = (COMAdminCatalogCollection)catalog.GetCollection("Applications");
                applications.Populate();
    
                foreach (COMAdminCatalogObject application in applications)
                {
                    if (application.get_Value("Name") == "COM+ QC Dead Letter Queue Listener")
                    {
                        COMAdminCatalogCollection components;
                        components = (COMAdminCatalogCollection)applications.GetCollection("Components", application.Key);
                        components.Populate();
    
                        foreach (COMAdminCatalogObject component in components)
                        {
                            Console.WriteLine("Component: " + component.Name);
                            component.set_Value("Transaction", COMAdminTransactionOptions.COMAdminTransactionNone);
                        }
                        components.SaveChanges();
                    }
                }
            }
        }
    }