My application requires the windows feature
to be installed.
I currently use this solution to see if it is installed.
Now how will I be able to installe it once I know it is not running. I have tried:
List<ServiceController> services = ServiceController.GetServices( ).ToList( );
ServiceController msQue = services.Find( o => 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( ); // <- I was hoping to look for a method that will turn feature on or off
}