程序代码
<%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
%>