Share via

Programmatically detect if Media Feature Pack is installed

Daniel Gessler 1 Reputation point
2021-10-12T19:28:31.447+00:00

Hey,

I'm creating a launcher application for a game that requires Media Feature Pack to be installed on the computer. Since I don't want to always download and force install Media Feature Pack, I'd love to be able to programmatically check if this software is installed or not. I found a question but the answer doesn't seem to work (when I installed Media Feature Pack, this entry hasn't changed, same when i uninstalled Media Feature Pack).

How can I check programmatically if Media Feature Pack is installed on a computer?

Best,
Daniel

Developer technologies | C#
Developer technologies | C#

An object-oriented and type-safe programming language that has its roots in the C family of languages and includes support for component-oriented programming.


2 answers

Sort by: Most helpful
  1. Castorix31 91,876 Reputation points
    2021-10-12T20:28:08.697+00:00

    Win32_OptionalFeature seems to work for me

    Was this answer helpful?

    1 person found this answer helpful.
    0 comments No comments

  2. Timon Yang-MSFT 9,611 Reputation points
    2021-10-13T02:18:17.487+00:00

    HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Setup\WindowsFeatures\WindowsMediaVersion

    Reading this registry key should also solve your problem, but I agree that Castorix31's solution will be better.

    This is a sample code using Win32_OptionalFeature:

                ManagementClass objMC = new ManagementClass("Win32_OptionalFeature");  
                ManagementObjectCollection objMOC = objMC.GetInstances();  
                foreach (ManagementObject objMO in objMOC)  
                {  
                    string featureName = (string)objMO.Properties["Name"].Value;  
                    Console.WriteLine(featureName);  
                }  
    

    If the response is helpful, please click "Accept Answer" and upvote it.
    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.

    Was this answer helpful?

    0 comments No comments

Your answer

Answers can be marked as 'Accepted' by the question author and 'Recommended' by moderators, which helps users know the answer solved the author's problem.