Software Detection RRS feed

  • Question

  • in a console application. Is it possible to to detect installed software. Like SQL Server 2008 R2.

    Some of my programs require SQL Server 2008 R2 and I wanted to make sure that the software was installed 1st. Before the program loads or (runs)




    Toppers BBS http://toppersbbs.dtdns.net
    Wednesday, August 25, 2010 1:21 PM


All replies

  • it's been over 24 hours, come on guys. I know some one has to know how to do this


    Toppers BBS http://toppersbbs.dtdns.net
    Thursday, August 26, 2010 9:17 PM
  • Hi Joesoft11a,

    Welcome to MSDN forum.

    As your concern, would you like to detect whether SQL is installed on your machine or not before you would like to install other applications?

    This function’s key point is to search all of SQLs’ service names and display names.

    You could refer the following link, which talks about your concerns.

    I think that this blog could help you solve your concerns.




    Hope this helps!

    Best Regards

    Larcolais Gong

    Please remember to mark the replies as answers if they help and unmark them if they provide no help.
    Welcome to the All-In-One Code Framework! If you have any feedback, please tell us.
    Friday, August 27, 2010 10:22 AM
  • Sorry, I didn't get a reply from you until just now. So that works for me. It seems to work on the 1st part. If I add this on the end. It doesn't seem to work. You mite want to try this yourself


    string servicename2 = "SQL Server";
    else if(!service.ServiceName.Contains(servicename2))
      serviceoutput = serviceoutput = "You Do not have the required SQL services to use this software." + System.Environment.NewLine;

    This should return that the software is not installed and well This is the only option that returns some out put.


    Toppers BBS http://toppersbbs.dtdns.net C# Windows and Console applications. PHP, Mysql. HTML
    Wednesday, September 1, 2010 12:02 PM
  • I thought I would share with what I came up with. My code is below and it does work. This is in a Windows Form Application


     private void GetMeSQL_Click(object sender, EventArgs e)
          string servicename = "SQL";
          string serviceoutput = string.Empty;
          ServiceController[] services = ServiceController.GetServices();
          foreach (ServiceController service in services)
             if (service == null)
             if (service.ServiceName.Contains(servicename))  
                  serviceoutput = serviceoutput + System.Environment.NewLine + "Service Name = " + service.ServiceName + System.Environment.NewLine + "Display Name = " + service.DisplayName + System.Environment.NewLine;
          if (serviceoutput == "")
            serviceoutput += "There are no SQL Server instances present on this machine!" + System.Environment.NewLine;
        richTextBox1.Text = serviceoutput;

    Have fun


    Toppers BBS http://toppersbbs.dtdns.net C# Windows and Console applications. PHP, Mysql. HTML
    Tuesday, September 14, 2010 12:39 PM