先在IIS上导出配置文件为iis.xml,然后再创建一个asp文件,代码如下: 

  1. <%option explicit 
  2. dim fso 
  3. Set FSO = Server.CreateObject("Scripting.FileSystemObject")  
  4. dim ts 
  5. Set ts = fso.OpenTextFile(server.MapPath("iis.xml"),1)  '修改此处的iis备份文件名即可,同目录下哦 
  6. dim content 
  7. content= ts.ReadAll 
  8. content=split(content,"<IIsWebServer"
  9. function getdomain(str) 
  10. dim reg,readstr,matches,match1 
  11. set reg=new Regexp 
  12. reg.Multiline=True 
  13. reg.Global=false
  14. reg.IgnoreCase=true
  15. reg.Pattern="ServerComment(.*)\s"
  16. Set matches = reg.execute(str) 
  17.   For Each match1 in matches 
  18.    readstr=match1.Value 
  19.   Next 
  20. Set matches = Nothing 
  21. Set reg = Nothing 
  22. getdomain=replace(readstr,"ServerComment=",""
  23. getdomain=replace(getdomain,"""",""
  24. end function
  25. function GetKey(HTML,Start,Last)  
  26. dim filearray,filearray2 
  27. filearray=split(HTML,Start)  
  28. filearray2=split(filearray(1),Last)  
  29. GetKey=filearray2(0)  
  30. End function
  31. function Clear(content) 
  32. dim arr,i 
  33. arr=split(content,":"
  34. for i=0 to ubound(arr) 
  35. if instr(arr(i),".")>0 then 
  36. Clear=Clear & arr(i) 
  37. end if
  38. next 
  39. end function
  40. response.Clear() 
  41. dim i 
  42. for i=0 to ubound(content) 
  43. if instr(content(i),"ServerBindings")>0 then 
  44. response.Write (i)&" 描述:"&getdomain(content(i))&"<br>主机头:"&Clear(GetKey(content(i),"ServerBindings=""",""""))&"<br><br>"
  45. end if
  46. next 
  47. %> 
    把这个如保存为iis.asp,那个要把iis.asp与iis.xml放在同一个站点目录下并同级,然后
    执行iis.asp就可以了