COM+ application deployment using command-line
Asked Answered
E

2

6

I need to deploy my COM dll as a COM+ application. I used to do that from Component Services manager (dcomcnfg.exe). But my requirement is to deploy it from command-line. Is there a command to do that?

Update: And how to uninstall the same?

Thanks.

Extragalactic answered 10/5, 2010 at 8:58 Comment(0)
E
7

Here are a couple of scripts that dump a COM+ application's settings to an XML file, as well as installs applications from and XML file. It provided me a good framework for doing something similar a while back. It contains example code of how to create and remove COM+ applications using the COM+ administration API.

Epos answered 23/6, 2010 at 15:35 Comment(4)
Glad you found the scripts useful Garett.Ferritin
Hi Len. They were very useful. Really great work. Enjoyed reading your site over the years.Epos
For those of us still working with COM+ in 2013 - FANTASTIC. Thanks a lot and Thanks, Len.Kolva
(Oh - and there's a missing bracket on line 1360 of the install script ;-)Kolva
A
0

This vbscript snippet creates an application and installs a component:

Dim catalog
Dim applications
Dim application
Set catalog = CreateObject("COMAdmin.COMAdminCatalog")
Set applications = catalog.GetCollection("Applications")
Call applications.Populate
Set application = applications.Add()


' ID is an arbitrary GUID, that you can create using uuidgen
application.Value("ID") = "{da2d72e3-f402-4f98-a415-66d21dafc0a9}"
application.Value("Name") = "SampleApp"
application.Value("Activation") = 0' COMAdmin.COMAdminActivationOptions.COMAdminActivationLocal
application.Value("ApplicationAccessChecksEnabled") = 0 'COMAdmin.COMAdminAccessChecksLevelOptions.COMAdminAccessChecksApplicationComponentLevel
application.Value("Description") = "Sample Application"
'application.Value("Identity") = "machine\administrator"
'application.Value("Password") = "YourPassword"
application.Value("RunForever") = True

Call applications.SaveChanges

catalog.InstallComponent "SampleApp", "C:\Documents and Settings\me\My Documents\Test\MyTestProj.dll", "", ""


Set application = Nothing
Set applications = Nothing
Set catalog = Nothing

This is running on Windows XP -- other OS's may have different behavior. And it does seem to be pretty temperamental. If it doesn't work the errors are really vague and unhelpful.

To delete I think you will have to iterate over the the components in the application and remove from the list as per this example. I think a similar approach would be required to remove the entire application.

References

See Configurating COM+ for a good easy to understand article (but is not in script). MSDN has a good reference on Automating COM+ Administration and also the complete COM+ Administration Reference.

Abbie answered 10/5, 2010 at 22:49 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.