战剑网络,网站建设,系统开发,程序设计

搜索Top
清空iislog中自己登录ip的vbs


搜索关键字:
清空iis log 中自己登录ip的vbs
责任编辑:admin   更新日期:2005-8-6


option explicit

dim sourcefile,ipaddress,objargs

const destfile="tempfile"
const forwriting = 2

dim text
dim fso,objnet,serviceobj


dim txtstream, txtstreamout

set objargs = wscript.arguments
if objargs.count = 2 then
sourcefile=objargs(0)
ipaddress=objargs(1)
else
wscript.echo "parameter error"+ vbcrlf
wscript.echo "usage:killlog.vbs logfilename yourip."
wscript.quit 1
end if

set fso = createobject("scripting.filesystemobject")
if fso.fileexists (sourcefile) then
set objnet = wscript.createobject( "wscript.network" )
set serviceobj = getobject("winnt://" & objnet.computername & "/w3svc")
set objnet=nothing
serviceobj.stop
wscript.sleep 6000
set txtstream = fso.opentextfile(sourcefile)
set txtstreamout = fso.opentextfile(destfile, forwriting, true)
do while not (txtstream.atendofstream)
text = txtstream.readline
if instr(text,ipaddress)=0 then
txtstreamout.writeline text
end if
loop

set txtstream = nothing
set txtstreamout = nothing

wscript.echo "the log file-- " & sourcefile &" has cleaned your ip!"


else
wscript.echo "the log file-- " & sourcefile & " has not found!"
wscript.quit
end if
fso.copyfile destfile, sourcefile
fso.deletefile destfile
set fso=nothing
serviceobj.start
set serviceobj = nothing


[ 打印本页 ] [ 收藏本页 ]

[上一篇]:全面优化ASP应用程序方法
[下一篇]:已经到底了

特别声明:本站除部分特别声明禁止转载的专稿外的其他文章可以自由转载,但请务必注明出处和原始作者。文章版权归文章原始作者所有。对于被本站转载文章的个人和网站,我们表示深深的谢意。如果本站转载的文章有版权问题请联系编辑人员,我们尽快予以更正。
搜索Top

关于我们 - 联系我们 - 广告业务 - 友情链接 - 网站制作 - 留言板 - 会员注册
All Right Zjm.Net.Cn (zjm Enterprise v3.0)
联系电话:0576-8603312 地址:浙江省台州市经济开发区
技术支持:点击这里给我发消息280610248 业务: 点击这里给我发消息40520767 客服: 点击这里给我发消息441758646
E-mail:zjm@zjm.net.cn 备案证书号:浙ICP备06030047号