最近备案烦死了,。今天又要把IIS里的所有域名。查询出来备案号。进行入库。
很是烦,
下面的方法就可以把IIS里所有的域名读出来
方法如下:
1.备份--》IIS
2.备份后文件放在--》C:WINDOWSsystem32inetsrvMetaBack
3.把文件复制出来--》把名称改成iisbfwj.xml
4.把下面的代码复制到ASP新文件里 和把iisbfwj.xml复制到同一目录
5.运行ASP代码。即可得到所有的域名。
| 以下是代码片段:
<%option explicit dim fso Set FSO = Server.CreateObject("Scripting.FileSystemObject") dim ts Set ts = fso.OpenTextFile(server.MapPath("iisbfwj.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 %> |