批量导出IIS的全部域名

top:0px;margin-bottom:8px;list-style:none;text-indent:2em;color:#333333;font-family:宋体;font-size:14px;line-height:28px;white-space:normal;background-color:#FFFFFF;"> 比如服务器有300多个站点时,不可能一个一个检查吧,上网搜了下,有个程序稍合适,但导出的是网站域名站点名,我修改为导出域名列表,同时解决了导出一个站点绑定多个域名的问题,更适合自己的应用,原程序无从考究出处,本着开源原则,现把修改后的源码放出来,希望能对大家有用。
使用方法:
  <strong> 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=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
%>

本博客所有文章如无特别注明均为原创。作者:sysdee复制或转载请以超链接形式注明转自 成功志
原文地址《批量导出IIS的全部域名
分享到:更多

相关推荐

发表评论

路人甲 表情
看不清楚?点图切换 Ctrl+Enter快速提交

网友评论(0)