艺术迷网
艺术迷 >> 网页设计 >> asp学习 >> FSO专题--清空iislog中自己登录ip的vbs
2007-11-2 9:53:51   作者:   来源:   点击:1330
页面功能: 【评论】有错就点】 【字体: 】 【打印】 【关闭【收藏本页】

清空iislog中自己登录ip的vbs

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


声明:本站刊载此文不代表同意其说法或描述,仅为提供更多信息,也不构成任何建议。如有疑问请与站长联系。
网友评论

RE:FSO专题--清空iislog中自己登录ip的vbs

 回复者:匿名 时间:2006-4-27
不懂

RE:FSO专题--清空iislog中自己登录ip的vbs

 回复者:匿名 时间:2006-4-27
不懂
发表评论
您的姓名: 匿名发送
电子邮件:
评论内容:
不能超过100个字符



所有留言只代表网友个人观点,不代表本站观点。
请各位遵纪守法并注意语言文明。
新闻搜索
关 键 词:
搜索范围:
全站精华
图文精彩