您的浏览器禁用了Javascript,可能无法正常浏览我们的网站,请更改后再进行浏览,谢谢
主 题: 读取服务器iis列表,列出服务器网站,列出服务器域名
已阅:1804 / 回复:1(楼主)
把下面程序复制到记事本后,保存为一个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
%>
个性签名
建网站188元 0531-66814598
作者:xueok (2013-8-10 11:04:27)
188元建网站 免费试用 满意付款 0531-82862131

目前不允许游客回复,请 登录 注册 发贴.