This vbscript snippet creates the application and installs the 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 works on Windows XP — another OS may have a different behavior. And that seems pretty temperamental. If this does not work, the errors are really vague and useless.
To remove, I think you will have to iterate over the components in the application and remove from the list according to this example . I think that uninstalling the entire application will require a similar approach.
References
See Configuring COM + for a good easy-to-read article (but not in a script). MSDN has a good link to COM + Administration Automation , as well as a complete COM + Administration Guide .
Randy levy
source share