如何检查IIS 6管理兼容性功能是否已经安装?

编程入门 行业动态 更新时间:2024-10-28 02:31:25
本文介绍了如何检查IIS 6管理兼容性功能是否已经安装?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

无论使用哪种VB.NET,C#,或VBScript,我怎么能检查IIS 6管理兼容性功能及其子功能已经被安装在计算机上运行IIS 7.x的?

Using either VB.NET, C#, or VBScript, how can I check if the IIS 6 Management Compatibility feature and its subfeatures have been installed on a machine running IIS 7.x?

推荐答案

我进行使用注册表车间的试用副本(比较注册管理功能)一些测试,发现如下:

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

如果安装了IIS 7.x中,下面的注册表项包含已安装的子组件的信息:

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

HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\InetStp\Components

HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\InetStp\Components

每个安装特征被表示与双字节00000001的一个值。如果未安装的功能,缺少值

Each installed feature is represented with a value of DWORD 0x00000001. If a feature is not installed, the value is missing.

对于Web管理工具,该值名称如下:

For the 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)

请注意,这些组件的名称从Windows 7安装来,并可能会与Windows Server 2008中的略有不同,虽然注册表项应该是相同的。

Note that these component names came from a Windows 7 installation and might differ slightly from those of Windows Server 2008, though the Registry keys should be the same.

一些本在一份报告中提到的这篇文章:的使用托管代码检测是否安装IIS和ASP / ASP.NET被注册

Some of this is mentioned in a note to this article: Using Managed Code to Detect if IIS is Installed and ASP/ASP.NET is Registered

这些和其他子列表可以这里找到:安装Components\">发现

A list of these and other subcomponents can be found here: Discover Installed Components

更新:

从最终代码的一些核心功能。这不是完整的代码,但应该是足够的人谁花费的时间查找组件名称为各IIS版本:

Some core functions from the final code. This is not the complete code but should be enough for anyone who spends the time looking up the component names for the various IIS versions:

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's registry using WMI. ' Parameters: ' RootKey - The registry hive (see msdn.microsoft/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: ' stackoverflow/questions/1229760/how-do-i-read-64-bit-registry-values-from-vbscript-running-as-a-an-msi-post-inst ' msdn.microsoft/en-us/library/aa393067(VS.85).aspx ' msdn.microsoft/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

更多推荐

如何检查IIS 6管理兼容性功能是否已经安装?

本文发布于:2023-07-17 06:35:25,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1130449.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:性功能   已经安装   IIS

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!