How to detect mismatching Installed IIS feature names using C#?

2023-04-06T07:57:34.92+00:00

I am trying to install a list of IIS features through a C# application and I need to detect if my required features are already installed. Currently I am using the following registry to look for feature name, HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\InetStp\Components but few features have name mismatches such as Featurename: iis-directorybrowsing and Registry name: Directorybrowse Featurename: iis-applicationinit and Registry name: AppWarmUp Can someone help me with the most reliable detection method available? Thanks in advance!

Windows development | Internet Information Services
Developer technologies | C#
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. Lex Li 6,037 Reputation points Microsoft Employee
    2023-04-06T17:37:22.8566667+00:00

    It's not a name mismatch. IIS-* are the DISM parameter names, while the registry key names are just for registry key usage. You need to build up the name mapping relationship yourself, based on articles like https://learn.microsoft.com/en-us/iis/install/installing-iis-7/discover-installed-components and https://learn.microsoft.com/en-us/iis/install/installing-iis-85/installing-iis-85-on-windows-server-2012-r2#ModulesinIIS85 So, that your code knows which DISM name maps to which registry key. There isn't a "most reliable" method.

    0 comments No comments

Your answer

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