Computers -> My Computer -> COM + Applications Op...">

How can I check "Allow internal IIS properties" in COM + application?

Component Services -> Computers -> My Computer -> COM + Applications

Open the COM + Application object.

Open the components.

Right-click the class and select Properties.

Under the "Advanced" section, there is a checkbox "Allow built-in IIS properties".

How can I check this checkbox programmatically?

I can create and delete COM + applications programmatically, but the ComApplication class doesn't seem to have a way to change the settings in the generated application.

+1


source to share


2 answers


I found out how to do it.

Apparently I need to collect a collection of COM + applications, find the one I want (by name), then get the set of components in the application, then browse the collection and set the attribute:

            //get collection of applications
        COMAdminCatalog catalog = new COMAdminCatalog();

        catalog.Connect("127.0.0.1");

        COMAdminCatalogCollection applications = (COMAdminCatalogCollection)catalog.GetCollection("Applications");

        applications.Populate(); //no idea why that is necessary, seems to be

        // appId for the application we are looking for
        object appId = new object();

        int count = applications.Count;
        ICatalogObject item;

        if (count == 0) return;

        //search collection for item with name we are looking for
        for (int i = 0; i < count; i++)
        {

            item = (ICatalogObject)applications.get_Item(i);

            if (applicationName == (string)item.get_Value("Name"))
            {

                appId = item.Key;

                Console.WriteLine("appId found for " + applicationName + ": " + appId.ToString());

            }

        }

        // get all components for the application
        COMAdminCatalogCollection components;

        components = (COMAdminCatalogCollection)applications.GetCollection("Components", appId);
        components.Populate(); // again, no idea why this is necessary

        // set the attribute in all components

        foreach (COMAdminCatalogObject component in components)
        {

            Console.WriteLine("Setting IISIntrinsics attribute in " + component.Name + ".");
            component.set_Value("IISIntrinsics", true);
            components.SaveChanges();

        }

      



I think it can be done better and with fewer casts. But I dont know how.

It will do it.

+3


source


I have no experience with this particular property, but it seems to be documented on MSDN .



0


source







All Articles