清空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
- 超级REAL视频播放器2006-3-30
- 正则表达式简介(微软)--3.正则表达式语法-ASP教程,正则表达式2006-4-8
- ASP对Cookies操作的详细介绍2006-4-30
- ASP中正则表达式的应用(2)2006-4-8
- FSO专题--巧用FileSystem组件实现WEB应用中的本地特定打印[图]2006-2-28
- 用javascript连接access数据库2006-4-4
- 改善ASP性能和外观的技巧集锦2006-3-2
- CSS入门5:伪类——动态链接2006-4-28
- 做WEB2.0网站可以参考的十九条规则2006-8-8
- FSO专题--巧用FileSystem组件实现WEB应用中的本地特定打印 2006-3-1
RE:FSO专题--清空iislog中自己登录ip的vbs
回复者:匿名 时间:2006-4-27