使用方法

1.在IIS中导出xml配置文件。可参考下面图片。在网站点右键,选择所有任务,选择保存至一个文件,例如存为iis.xml。

2.把下面程序复制到记事本后,保存为一个asp文件,例iis.asp,然后放在网站一个有执行脚本权限的目录即可执行。同时需要把刚才导出的xml文件放在同目录下。

 

 

<%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=Replace(content,chr(13),"")
content=Replace(content,chr(10),"")
content=Replace(content,chr(32),"")
content=split(content,"IIsWebServe")

function getdomain(str)
dim reg,readstr,matches,match1
set reg=new Regexp
 reg.Multiline=True
 reg.Global=false
 reg.IgnoreCase=true
 reg.Pattern="ServerBindings(.*)ServerComment"
 Set matches = reg.execute(str)
  For Each match1 in matches
   readstr=match1.Value
  Next
Set matches = Nothingx
Set reg = Nothing
getdomain=replace(readstr,"ServerBindings=","")
getdomain=replace(getdomain,"""","")
getdomain=replace(getdomain,"ServerComment","")

end function

response.Clear()
dim i
for i=0 to ubound(content)
if instr(content(i),"ServerBindings")>0 then
response.Write Replace(getdomain(content(i)),":80:","<br>")&"<br>"
end if
next
%>