先在IIS上导出配置文件为iis.xml,然后再创建一个asp文件,代码如下:
- <%option explicit
- dim fso
- Set FSO = Server.CreateObject("Scripting.FileSystemObject")
- dim ts
- Set ts = fso.OpenTextFile(server.MapPath("iis.xml"),1) '修改此处的iis备份文件名即可,同目录下哦
- dim content
- content= ts.ReadAll
- content=split(content,"<IIsWebServer")
- function getdomain(str)
- dim reg,readstr,matches,match1
- set reg=new Regexp
- reg.Multiline=True
- reg.Global=false
- reg.IgnoreCase=true
- reg.Pattern="ServerComment(.*)\s"
- Set matches = reg.execute(str)
- For Each match1 in matches
- readstr=match1.Value
- Next
- Set matches = Nothing
- Set reg = Nothing
- getdomain=replace(readstr,"ServerComment=","")
- getdomain=replace(getdomain,"""","")
- end function
- function GetKey(HTML,Start,Last)
- dim filearray,filearray2
- filearray=split(HTML,Start)
- filearray2=split(filearray(1),Last)
- GetKey=filearray2(0)
- End function
- function Clear(content)
- dim arr,i
- arr=split(content,":")
- for i=0 to ubound(arr)
- if instr(arr(i),".")>0 then
- Clear=Clear & arr(i)
- end if
- next
- end function
- response.Clear()
- dim i
- for i=0 to ubound(content)
- if instr(content(i),"ServerBindings")>0 then
- response.Write (i)&" 描述:"&getdomain(content(i))&"<br>主机头:"&Clear(GetKey(content(i),"ServerBindings=""",""""))&"<br><br>"
- end if
- next
- %>
把这个如保存为iis.asp,那个要把iis.asp与iis.xml放在同一个站点目录下并同级,然后
执行iis.asp就可以了
转载于:https://blog.51cto.com/guailele/761955