How to check if IIS 6 Management Compatibility has been installed?

Using VB.NET, C # or VBScript, how can I check if the IIS 6 management compatibility function and its sub-functions were installed on a machine with IIS 7.x?

+4
source share
1 answer

I performed some tests using a trial copy of the Workshop registry (Compare Registers function) and found the following:

If IIS 7.x is installed, the following registry key contains information about the installed subcomponents:

HKEY_LOCAL_MACHINE \ SOFTWARE \ Microsoft \ InetStp \ Components

Each installed function is represented with a DWORD value of 0x00000001. If the function is not set, the value is absent.

For web management tools, the value names are as follows:

Web Management Tools IIS 6 Management Compatibility IIS 6 Management Console (LegacySnapin) IIS 6 Scripting Tools (LegacyScripts) IIS 6 WMI Compatibility (WMICompatibility) IIS Metabase and IIS 6 configuration compatibility (Metabase + ADSICompatibility) IIS Management Console (ManagementConsole) IIS Management Scripts and Tools (ManagementScriptingTools) IIS Management Service (AdminService) 

Please note that these component names came from installing Windows 7 and may be slightly different from those related to Windows Server 2008, although the registry keys must be the same.

Some of them are mentioned in a note to this article: Using managed code to detect if IIS is installed and ASP / ASP.NET is registered

A list of these and other subcomponents can be found here: Open installed components

Update:

Some basic functions from the final code. This is not complete code, but should be sufficient for those who spend time looking for component names for different versions of IIS:

 Function IsIISComponentInstalled(ByVal ComponentName) Dim result Dim intProcessorArchitecture intProcessorArchitecture = GetProcessorArchitectureIIS() If intProcessorArchitecture = 64 Then '64-bit system On Error Resume Next Err.Clear result = RegReadDWORD(HKEY_LOCAL_MACHINE, "SOFTWARE\Microsoft\InetStp\Components", ComponentName, 64) If Err.Number <> 0 Then Err.Clear IsIISComponentInstalled = False Else If result = 1 Then IsIISComponentInstalled = True Else IsIISComponentInstalled = False End If End If Else '32-bit system If RegReadStringIIS("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\InetStp\Components\" & ComponentName) = "1" Then IsIISComponentInstalled = True Else IsIISComponentInstalled = False End If End If End Function Function GetProcessorArchitectureIIS() Dim strProcessorArchitecture Dim oShell Set oShell = CreateObject("Wscript.Shell") strProcessorArchitecture = oShell.RegRead("HKLM\SYSTEM\CurrentControlSet\Control\Session Manager\Environment\PROCESSOR_ARCHITECTURE") If strProcessorArchitecture = "x86" Then GetProcessorArchitectureIIS = 32 Else If strProcessorArchitecture = "AMD64" Then GetProcessorArchitectureIIS = 64 Else GetProcessorArchitectureIIS = 0 End If End If End Function Function RegReadStringIIS(sRegValue) Set oShell = CreateObject("WScript.Shell") On Error Resume Next RegReadStringIIS = oShell.RegRead(sRegValue) If Err Then RegReadStringIIS = "" Err.clear End If If VarType(RegReadStringIIS) < vbArray Then If RegReadStringIIS = sRegValue Then RegReadStringIIS = "" End If End If On Error Goto 0 End Function '------------------------------------------------------------------- ' Reads a REG_SZ value from the local computer registry using WMI. ' Parameters: ' RootKey - The registry hive (see http://msdn.microsoft.com/en-us/library/aa390788(VS.85).aspx for a list of possible values). ' Key - The key that contains the desired value. ' Value - The value that you want to get. ' RegType - The registry bitness: 32 or 64. ' 'References: ' http://stackoverflow.com/questions/1229760/how-do-i-read-64-bit-registry-values-from-vbscript-running-as-a-an-msi-post-inst ' http://msdn.microsoft.com/en-us/library/aa393067(VS.85).aspx ' http://msdn.microsoft.com/en-us/library/windows/desktop/aa390445(v=VS.85).aspx ' Function RegReadDWORD(RootKey, Key, Value, RegType) Dim oCtx, oLocator, oReg, oInParams, oOutParams Set oCtx = CreateObject("WbemScripting.SWbemNamedValueSet") oCtx.Add "__ProviderArchitecture", RegType Set oLocator = CreateObject("Wbemscripting.SWbemLocator") Set oReg = oLocator.ConnectServer("", "root\default", "", "", , , , oCtx).Get("StdRegProv") Set oInParams = oReg.Methods_("GetDWORDValue").InParameters oInParams.hDefKey = RootKey oInParams.sSubKeyName = Key oInParams.sValueName = Value Set oOutParams = oReg.ExecMethod_("GetDWORDValue", oInParams, , oCtx) RegReadDWORD = oOutParams.uValue End Function 
+8
source

Source: https://habr.com/ru/post/1307835/


All Articles