查看哪些站点正在使用IIS 7中的哪些IP

时间:2008-10-28 13:41:03

标签: iis-7

有没有办法快速列出哪些站点在IIS 7中的哪个IP地址?

如果我没记错的话,你可以在IIS 6中通过IP对域进行排序,这对我看到哪些IP可用有很大的帮助。

2 个答案:

答案 0 :(得分:6)

看看APPCMD

例如,要列出计算机上的所有站点,请使用以下命令行:

   %systemroot%\system32\inetsrv\APPCMD list sites

答案 1 :(得分:3)

您可以尝试以下脚本:

MachineName = "localhost"
IIsObjectPath = "IIS://" & MachineName & "/w3svc"

WScript.Echo "Checking : " & IISObjectPath

Set IIsObject = GetObject(IIsObjectPath)
for each obj in IISObject
    if (Obj.Class = "IIsWebServer") then
        BindingPath = IIsObjectPath & "/" & Obj.Name

        Set IIsObjectIP = GetObject(BindingPath)
        wScript.Echo BindingPath & " - " & IISObjectIP.ServerComment

        ValueList = IISObjectIP.Get("ServerBindings")
                ValueString = ""
        For ValueIndex = 0 To UBound(ValueList)
            value = ValueList(ValueIndex)
            Values = split(value, ":")
            IP = values(0)
            if (IP = "") then
                IP = "(All Unassigned)"
            end if 
            TCP = values(1)
            if (TCP = "") then
                TCP = "80"
            end if 
            HostHeader = values(2)

            if (HostHeader <> "") then
                    wScript.Echo "    IP = " & IP & " TCP/IP Port = " & TCP & ", HostHeader = " & HostHeader
            else
                    wScript.Echo "    IP = " & IP & " TCP/IP Port = " & TCP 
            end if
                Next                                     
        wScript.Echo ""
        set IISObjectIP = Nothing
    end if
next
set IISObject = Nothing

(来源www.iisfaq.com)