ManagementScope and Win32_Product retrieving executable paths
<p>I am currently working on a C# project. I am using the ManagementScope with the Win32_Product. I am successfully retrieving the software name, vendor and the install location but I want to be able to get either the path to the actual executable to launch the software. </p>

<p>I am using the following code to retrieve the information. </p>

<pre><code>try
            {
                ManagementScope scope = new ManagementScope("\\\\.\\ROOT\\cimv2");

                ObjectQuery query = new ObjectQuery("SELECT * FROM Win32_Product");

                ManagementObjectSearcher searcher = new ManagementObjectSearcher(scope, query);

                ManagementObjectCollection queryCollection = searcher.Get();

                DataSet ds = new DataSet();
                dt = new DataTable();
                ds.Tables.Add(dt);

                DataColumn sofNameCol = new DataColumn("Software", typeof(string));
                DataColumn sofPublish = new DataColumn("Publisher", typeof(string));
                DataColumn sofInstallCol = new DataColumn("Install Path", typeof(string));
                dt.Columns.Add(sofNameCol);
                dt.Columns.Add(sofPublish);
                dt.Columns.Add(sofInstallCol);

                foreach (ManagementObject m in queryCollection)
                {
                    string softwareName = m["Name"].ToString();
                    string publisher = m["Vendor"].ToString();
                    object install = m["InstallLocation"];

                    if (install != null)
                    {
                        DataRow rw = dt.NewRow();
                        dt.Rows.Add(rw);

                        rw["Software"] = softwareName;
                        rw["Publisher"] = publisher;
                        rw["Install Path"] = install;
                    }
                    Console.WriteLine("Software Name: {0}", m["Name"]);
                    Console.WriteLine("Publisher: {0}", m["Vendor"]);
                    Console.WriteLine("Path: {0}", m["InstallLocation"]);
                }
                this.Dispatcher.Invoke(System.Windows.Threading.DispatcherPriority.Background, new System.Windows.Threading.DispatcherOperationCallback(delegate
                {
                    tblSoftware.ItemsSource = ds.Tables[0].DefaultView;
                    sortData();
                    return null;
                }), null);

            }
            catch (ManagementException ex)
            {
                Console.WriteLine("Management Error: " + ex.Message);
            }
</code></pre>

<p>I have tried google searches on how I can expand this code to retrieve either the executable path. Thanks for any help you can provide. </p>
