Yes, you'll need to do the following:

1. Run TlbImp.exe (.net Framework tool) to generate a managed runtime
rapper for the comadmin.dll library (which gives you programmatic access to
the COM+ catalog. I think the syntax is:

 tlbimp comadmin.dll /out:comadminLIB.dll

You can also get this library wrapper through VS.NET and skip the next step
by adding a project reference on the COM tab to the "COM+ 1.0 Admin Type
Library" dll.

2. If you are using VS.NET, reference this DLL in your project references.
3. Place a using/imports statement at the top of your class file for
comadminDLL.
4. Place a using/imports statement at the top of your class file for
System.Enterprise services.
5. In your class method, instantiate the RegistrationHelper
(System.EnterpriseServices.RegistrationHelper).
6. Uinstall the assembly if it is already installed:

 helper.UninstallAssembly("fullassemblyname.dll","friendlyname")

7. Install your assembly into COM+

 helper.InstallAssembly("fullassemblyname.dll","friendlyname")

8. Create an instace of the COMAdminCategog object and ICatalogCollection:

 COMAdminCatalog cat = new COMAdminCatalog();
 ICatalogCollection col = cat.GetCollection("Applications") as
  ICatalogCollection;
 col.Populate();

9. Loop through the catalog collection to find your package, then set
the "Identity" and "Password" values of the ICatalogObject:

 foreach(ICatalogObject application in col)
 {
  if(application.get_Value("Name").ToString()
== "friendlyname")
  {
   Console.Write("\nSetting COM+ application package
identity");
   application.set_Value
("Identity", "domian\\username);
   application.set_Value
("Password", "somesecretpassword");
   col.SaveChanges();

   Console.WriteLine("Done!\n");

   break;
  }
 }

10. That should do it!


I hope you find this information helpful. Digging around for this can be
quite a task!

-Paul Laudeman

===================================
This list is hosted by DevelopMentor�  http://www.develop.com
NEW! ASP.NET courses you may be interested in:

2 Days of ASP.NET, 29 Sept 2003, in Redmond
http://www.develop.com/courses/2daspdotnet

Guerrilla ASP.NET, 13 Oct 2003, in Boston
http://www.develop.com/courses/gaspdotnet

View archives and manage your subscription(s) at http://discuss.develop.com

Reply via email to