Automated Administration of COM+ Part3, Automated Installation of COM+/NT dll:

 

Contributed by
Rating: 5 stars5 stars5 stars5 stars5 stars / 15
August 04, 2001
Rate this Article:
MEH MEH++


SEARCH ASP FREE
TOOLS YOU CAN USE

advertisement

Author: Sreedhar Koganti 

In my Previous article we saw how to Create a package ,Delete Package. In this article will see how to Add Dll’s into package. As i said in my previous article you can try these examples in ASP and VB. Personally I will prefer to write in VB. If you want to Create Install/Uninstall package for COM+ dll always writing in VB is preferable. To do this in VB first you have to refer the Com+ admin type library(comadmin.dll). This Comadmin.dll has several classes. Here i am using COMAdmin.COMAdminCatalog. We discussed about comadmincatalogcollecion in my previous article. Inorder to Install Com+ Dll first we need to know into which package we wanto install, which dll we wanto install. Here i am trying to install dll in "SamplePackage" Package. For that i am using "Test.dll" To install this we have to us InstallComponent porperty from COMAdminCatalog In Below example I tried to install Test.dll into "SamplePackage". This example you can get form downloads. It's in VB. (use this code in VB sub or Function or in asp)

 Private Sub DllInstall_Click() On Error GoTo errloop Dim objCOM As COMAdmin.COMAdminCatalog Set objCOM CreateObject("COMAdmin.COMAdminCatalog") 'below Code explains to add the component to App objCOM.InstallComponent "SamplePackage", "Test.dll", "", "" Set objCOM = Nothing MsgBox "your Dll is Successfully installed in" & cmbApp.Text & "Package" Exit Sub errloop: MsgBox "Please Select a package name / enter the Dll Name with Path", vbInformation, "Installer Information" Err.Clear End Sub 

 
The above code will Install the Test.dll into SamplePackage. InstallComponent method will take four parameters. The first parameter is the application key, and the second one is the file name (DLL), third is external type library (if any), and the last parameter is the name of the proxy-stub DLL name (if any). Uninstall The Dll From The Package: 

 Dim COMObject As COMAdmin.COMAdminCatalog Dim AdminCatCol As COMAdminCatalogCollection Dim AdminCatColOne As COMAdminCatalogCollection Dim AdminCatObj As COMAdminCatalogObject Dim ComCountColl As Integer Dim blnFound As Boolean Dim Comp As String Comp InStr(Text1.Text"."Comp Left(Text1CompRemoveComponent False Set COMObject CreateObject("COMAdmin.COMAdminCatalog"Set AdminCatCol COMObject.GetCollection("Applications"AdminCatCol.Populate Found False 'Iterate through Collection For Each AdminCatObj In AdminCatCol 'Assign Component Collection to AdminCatColOne Set AdminCatColOne AdminCatCol.GetCollection("Components"AdminCatObj.KeyAdminCatColOne.Populate 'Iterate through Collection If AdminCatColOne.Count = 0 Then GoTo Loopone For ComCountColl = AdminCatColOne.Count - 1 To 0 Step -1 'Check the Name in the Collection If InStr(UCase(AdminCatColOne.Item(ComCountColl).Name), UCase(Comp)) > 0 Then 'If the name matches Make RemoveEnable to true If AdminCatColOne.RemoveEnabled = True Then blnFound = True COMObject.ShutdownApplication AdminCatObj.Key AdminCatColOne.Remove ComCountColl AdminCatColOne.SaveChanges Else MsgBox "RemoveEnabled property returned false" End If End If Next Loopone: If blnFound = True Then Exit For Next If blnFound Then MsgBox "Component Removed Successfully" Else MsgBox "Unable to find the Dll ....(Please Dont' enter the Path)" End If If blnFound = True Then RemoveComponent = True Set AdminCatObj = Nothing Set AdminCatCol = Nothing Set COMObject = Nothing 

********************************************************** To Uninstall the dll from the COM+ , actuall way is First we have to find the KeyID of the dll then we have to check for the Key id in all the packages.If you find Id then delete it. But here i followed round about method by keeping basic reades in my mind. Reades can understand this approch very easily even though they doesend knwo about KEY. Here in my first step i am accepting the dll name from the text box.Then i am taking only name part from the text box. Ex: fi i have dll name as FileProc.dll, From this i am taking "Fileproc." , and i am checking for "FileProc." To do this I am taking All the Applications names as collection into "AdminCatCol". Again From each Application i am taking Component Collection. From the Component collection i am taking each class of the component and i am comparing with the entered dll name. If it is there then i am removing the class form that collecton and i am saving the collection. Once you see the code You can get clear idea.You can down the code from downloads. You can get more information on this in http://msdn.microsoft.com. By making some changes in the above code and keeping more error trapping you can create Make good Install Package. Note: In this example i am not checking whether the dll is installed Previouslly or not. I am installing the specified dll if it is there or not. You can add that code to make better installer package. Note: This code can also be implemented in ASP with some changes. It will help people who want to deploy COM+ dll with out manual process. Author: Sreedhar Koganti Working in Unisys as a Technical Team Lead Expertixe in ASP,COM+,XML,SOAP,NTService,VB, Drop of .Net Article Writer in asptoday.com,Aspalliance.com,aspfree.com

blog comments powered by Disqus
ASP CODE ARTICLES

- ASP Forms
- ASP: The Beginning
- Getting Remote Files With ASP Continued
- Inbox and Outbox Manipulation in ASP
- Relational DropDownList Using VB.NET
- Ad Tracking URL Hits
- Use ViewState to display one record per page...
- Send Email using ASP.NET formatted in HTML
- ASP File Explorer
- ASP/XML Interview questions by Srivatsan Sri...
- Pressing RETURN won't submit the form
- This shows how you get the TEXT of a combo r...
- Group Data by Adrian Forbes
- Multiple checkbox select sample
- Multiple checkbox select with all values sam...

ASP Web Hosting ASP.Net Web Hosting Windows Web Hosting
 
 
 

ASP Free Forums 
 RSS  Tutorials RSS
 RSS  Forums RSS
 RSS  All Feeds
Site Map 
Request Media Kit
Write For Us Get Paid 
Weekly Newsletter
 
Developer Updates  
Free Website Content 
Privacy Policy 
Support 


© 2003-2012 by Developer Shed. All rights reserved. DS Cluster 8 - Follow our Sitemap
Most Popular Topics
All ASP.Net Tutorials