How to start Windows services from C# code

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • nivedita

    How to start Windows services from C# code

    I got below function from http://techinterviewquestion.blogspot.com/
    blog. it is working fine. i used

    public void StartService(st ring ServiceName)
    {
    ServiceControll er sc = new ServiceControll er(ServiceName) ;
    if (sc != null && sc.Status == ServiceControll erStatus.Stoppe d)
    {

    sc.Start();
    sc.WaitForStatu s(ServiceContro llerStatus.Runn ing);

    }
    }
  • Mark Rae [MVP]

    #2
    Re: How to start Windows services from C# code

    "nivedita" <Nivedita2104@g mail.comwrote in message
    news:a6c892b1-8df1-4910-921e-6282189d6768@r3 5g2000prm.googl egroups.com...
    I got below function from http://techinterviewquestion.blogspot.com/
    blog. it is working fine. i used
    This is the ASP.NET newsgroup - do you have an issue with ASP.NET...?


    --
    Mark Rae
    ASP.NET MVP


    Comment

    • Juan T. Llibre

      #3
      Re: How to start Windows services from C# code

      re:
      !do you have an issue with ASP.NET...?

      Nah. He's spamming this newsgroup.




      Juan T. Llibre, asp.net MVP
      asp.net faq : http://asp.net.do/faq/
      foros de asp.net, en espaƱol : http://asp.net.do/foros/
      =============== =============== ========
      "Mark Rae [MVP]" <mark@markNOSPA Mrae.netwrote in message news:e3xf1tv8IH A.4536@TK2MSFTN GP05.phx.gbl...
      "nivedita" <Nivedita2104@g mail.comwrote in message
      news:a6c892b1-8df1-4910-921e-6282189d6768@r3 5g2000prm.googl egroups.com...
      >
      >I got below function from http://techinterviewquestion.blogspot.com/
      >blog. it is working fine. i used
      >
      This is the ASP.NET newsgroup - do you have an issue with ASP.NET...?
      >
      >
      --
      Mark Rae
      ASP.NET MVP
      http://www.markrae.net

      Comment

      • Munna

        #4
        Re: How to start Windows services from C# code

        HI,

        As mark said not a asp.net related.. but yet...

        check out this.

        This short code snippet shows how you can access the status of any windows services using C# or VB.NET. Also, it is easy to start and stop windows services programmatically.


        Might help you!

        Best of luck

        Munna

        Comment

        • Munna

          #5
          Re: How to start Windows services from C# code

          Yep ... she is spamming! .. checked her other posts... totally
          spamming!

          Comment

          Working...