Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / ASP.NET / General / July 2007

Tip: Looking for answers? Try searching our database.

Shutting down COM app from a command line

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Larry Bud - 30 Jul 2007 15:30 GMT
Not sure where else to post this....  One of our developers quit and
I'm taking over stuff from him.

He had a COM app that would lock files on occasion (yeah, thanks for
leaving that in production instead of finding the real problem)...
anyway, the "fix" was to shut down the com app when it would lock the
file.

Any way to do that from a command line?
Aidy - 30 Jul 2007 15:50 GMT
What do you mean by "COM app".  An EXE?  A COM+ Application?

> Not sure where else to post this....  One of our developers quit and
> I'm taking over stuff from him.
[quoted text clipped - 5 lines]
>
> Any way to do that from a command line?
Larry Bud - 30 Jul 2007 16:02 GMT
> > Not sure where else to post this....  One of our developers quit and
> > I'm taking over stuff from him.
[quoted text clipped - 5 lines]
>
> > Any way to do that from a command line?- Hide quoted text -

> What do you mean by "COM app".  An EXE?  A COM+ Application?

Sorry.

Yes, a COM+ Application.
Aidy - 30 Jul 2007 16:39 GMT
You could script it or make a small app to do it;

http://www.devx.com/vb2themax/Tip/19633

>> > Not sure where else to post this....  One of our developers quit and
>> > I'm taking over stuff from him.
[quoted text clipped - 11 lines]
>
> Yes, a COM+ Application.
Eric - 31 Jul 2007 21:24 GMT
using System;
using System.Collections;
using System.Collections.Specialized;
using COMAdmin; // This needs a reference to the "COM+ Admin" dll on
the COM tab

namespace xxx
{
 class ShutdownCom
 {
   #region Get COM+ Applications
   public StringCollection GetCOMApplications()
   {
     StringCollection collection = new StringCollection();
     try
     {
       ICOMAdminCatalog objAdmin;
       ICatalogCollection objCollection;

       objAdmin = (ICOMAdminCatalog) new
COMAdmin.COMAdminCatalog();
       objCollection = (ICatalogCollection)
objAdmin.GetCollection("Applications");
       objCollection.Populate();

       foreach(COMAdmin.COMAdminCatalogObject objApp in
objCollection)
       {
         collection.Add(objApp.Name.ToString());
         // Console.WriteLine(objApp.Name.ToString());
       }
     }
     catch(Exception ex)
     {
       Console.WriteLine("Error: " + ex.Message);
       return null;
     }
     return collection;
   }
   #endregion

   #region Shutting Down  COM+ Application
   public void ShutDownCOMApplication(string appName)
   {
     try
     {
       ICOMAdminCatalog objAdmin;
       ICatalogCollection objCollection;

       objAdmin = (ICOMAdminCatalog) new
COMAdmin.COMAdminCatalog();
       objCollection = (ICatalogCollection)
objAdmin.GetCollection("Applications");

       Console.WriteLine("Shutting down: " + appName);
       objAdmin.ShutdownApplication(appName);
     }
     catch(Exception ex)
     {
       Console.WriteLine("Unable to shutdown the application, err=" +
ex.Message);
     }
   }
   #endregion

   [STAThread]
   static void Main(string[] args)
   {
     // create an instance of our class
     ShutdownCom shutdown = new ShutdownCom();

     // shutdown all applications that begin with ZC
     StringCollection appList = shutdown.GetCOMApplications();
     foreach (string appName in appList)
     {
       if (appName.ToUpper().StartsWith("ZC"))
         shutdown.ShutDownCOMApplication(appName);
     }
   }
 }
}

Rate this thread:







Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.