title: Install Windows Message Queuing programmatically
body: <p>My application requires the windows feature</p>
  
  <p><img src="https://i.stack.imgur.com/rkLBa.png" alt="enter image description here"></p>
  
  <p>to be installed.</p>
  
  <p>I currently use <a href="https://stackoverflow.com/a/6069270/637142">this solution</a> to see if it is installed.</p>
  
  <p>Now how will I be able to installe it once I know it is not running. I have tried:</p>
  
  <pre><code>List&lt;ServiceController&gt; services = ServiceController.GetServices( ).ToList( );
  ServiceController msQue = services.Find( o =&gt; o.ServiceName == "MSMQ" );
  
  if ( msQue != null )
  {
      if ( msQue.Status == ServiceControllerStatus.Running )
      {
          Console.Write( "it is running" );
          return;
      }
  }
  else
  {
      Console.WriteLine( "It is not running \n\nPress enter to install" );
      Console.Read( );
     msQue.Start( ); // &lt;- I was hoping to look for a method that will turn feature on or off                          
  }   
  </code></pre>