A couple of posts ago I talked about a GetUsageData webpart and how to access the data when not a site admin by using COM+ to retrieve the data.

But of course this needs to be installed.  Luckily for me we have a MSI library that Dan developed, which does all the sharepoint web part installation, as well as a host of other web based installation tasks that do not come out of the box with MS’s installation project.  But this only helps me with the webpart.

The earlier articles mention using Regsvsc to register the COM+ component or to allow lazy regristation.  Whilst manually registering is certainly better than lazy its still yet one more task that could be done as an MSI.

Here is a great article about registering COM+ components from start to finish with multiple methods. There is a section on writing an MSI installer class to acheive this using the .NET Library RegistrationHelper, it won’t take a genious for you to figure out how you can extend this to install your web part.

Note specifically the custom actions bit,  also look at custom action data as this is how you can get data into the MSI from the command line enabling unattended installations.  Also you can create a form in your dll to capture data in interactive mode to be fed into your installer (check /SILENT).

But is it enough, for me no.  RegistrationHelper does not let you configure the admin user details.  To achieve this you can do more.  First capture those details either from CustomActionData or your form. Then use techniques I found here

For those who hate vb.net here is some c#

Set a reference to COMAdmin library (its a COM one not .NET),  Have already registered the component in COM+ and stored the Package name in appID

catalog=new COMAdmin.COMAdminCatalog();
applications = (COMAdmin.COMAdminCatalogCollection)catalog.GetCollection(“Applications”);
applications.Populate();

foreach (COMAdmin.COMAdminCatalogObject applicationItem in applications)
{
    string s=applicationItem.Name.ToString() ;
    if (s==appID)
    {
        application=applicationItem;
        bGotOne=true;
        break;
    }
}

if (!bGotOne) return//I’m so slack !!

if (login.Length>0 && loginpwd.Length>0)
{
    application.set_Value(“Identity”, login);
    application.set_Value(“Password”,loginpwd);

    applications.SaveChanges();
}

Remember to Have GAC’d your component in code, and remember to uninstall all this too in the correct order.

Full list of articles I used to get here

http://www.carlosag.net/Articles/configureComPlus.aspx
http://www.15seconds.com/issue/030501.htm
http://blog.u2u.info/DottextWeb/patrick/archive/2004/10/20/235.aspx
http://blogs.microsoft.fr/rlondner/articles/7089.aspx

tags: , , , ,

Advertisements