WinBatch Tech Support Home

Database Search

If you can't find the information using the categories below, post a question over in our WinBatch Tech Support Forum.

TechHome

OLE COM ADO CDO ADSI LDAP
plus
plus
plus
plus
plus
plus
plus
plus
plus
plus
plus
plus
plus
plus
plus
plus
plus
plus
plus
plus
plus
plus
plus
plus
plus
plus
plus
plus
plus
plus
plus
plus
plus
plus
plus
plus
plus
plus
plus

Can't find the information you are looking for here? Then leave a message over on our WinBatch Tech Support Forum.

Remotely Stop or Start COM Components


Question:

I have several remote web servers that have some COM components in them as part of the web application...

I want to be able to remotely start/stop them with a winbatch util.

I know I could do it remotely using the MMC snap-in, but I want to give this power to the web developers without giving them the admin rights they would need on the box...I just want to do something programmaticaly to stop/start the com component.

Manually, you just open the comexp.msc snapin, go to your COM+ application, right click on the COM+ application that you want to restart and then shut it down, then start it. I want to figure out how to do it automatically - say every hour....or give someone else the ability to do it, mainly so that I can quit getting calls 5 times a day to restart the dang thing.

Answer:

Maybe via OLE through the COMAdmin library.

See:
http://msdn.microsoft.com/library/en-us/cossdk/html/f302eb02-2ef5-42ee-a18f-59f7e60b38df.asp?frame=true

The code *might* look something like this:

objCatalog = CreateObject("COMAdmin.COMAdminCatalog")
oCatalogCol = objCatalog.GetCollection("Applications")
list = ""
oCatalogCol.Populate
For i = 0 To oCatalogCol.Count - 1
    list = StrCat(list, @TAB, oCatalogCol.Item(i).Name)
Next

list = StrTrim(list)
appname = AskItemlist("Choose Application to start", list, @TAB, @UNSORTED, @SINGLE)
objCatalog.StartApplication(appname)
;or
;objCatalog.ShutdownApplication(appname)
oCatalogCol = 0
objCatalog = 0

Article ID:   W17097
File Created: 2007:07:03:14:28:18
Last Updated: 2007:07:03:14:28:18