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.
Win32_OptionalFeature seems to work for me
This browser is no longer supported.
Upgrade to Microsoft Edge to take advantage of the latest features, security updates, and technical support.
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
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.
Win32_OptionalFeature seems to work for me
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.