Click here to Skip to main content
15,886,026 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi all,
First i want to write batch script to remove the Com+ application Dll or component
and also install the new Dll or component by the same batch script.

so far i saw some commands which works on cmd,

msiexec -x application_name.msi

which uninstall the Com plus application.but i want to delete the component and update the new component only.please help me.....


Thanks in Advance........

Regards,

Lala boy
Posted

To Register a COM dll :
c:\> regsvr32.exe /i comdllname.dll


To Unregister a COM dll :
c:\> regsvr32.exe /u comdllname.dll
 
Share this answer
 
You can use the COMAdmin.COMAdminCatalog object to remove components from a COM+ Application. You can do it through powershell or vbscript.

Here is a powershell example for removing a specific component from a specific application.

PHP
$comCatalog = New-Object -ComObject COMAdmin.COMAdminCatalog
$appColl = $comCatalog.GetCollection("Applications")
$appColl.Populate()

$app = $appColl | where {$_.Name -eq "COMAPPNAME"}
$compColl = $appColl.GetCollection("Components", $app.Key)
$compColl.Populate()

$index = 0
foreach($component in $compColl) {
    if ($component.Name -eq "SOMECOMPONENT.NAME") {
        $compColl.Remove($index)
        $compColl.SaveChanges()
    }
    $index++
}
 
Share this answer
 
Comments
Member 11303910 12-Dec-14 5:14am    
How do you ADD instead of remove?

$compColl.Add($index)? Also - how do you set certain properties? i.e. Bitness and Transaction?
Stinebaugh 19-Jan-16 13:09pm    
To add a component, use the $comCatalog object.

$comCatalog.InstallComponent("COMAPPNAME", "C:\SomePath\MyDll.dll", "", "")

For setting the properties, you just need to know the name and proper value. Using my code from above, instead of removing, you would do this to set the Transaction to Required.

$component.Value("Transaction") = 3
$compColl.SaveChanges()

Here is a link to MSDN page with the component properties and values you can set: https://msdn.microsoft.com/en-us/library/windows/desktop/ms688285(v=vs.85).aspx#transaction

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900