清空iis log 中自己登录ip的vbs
[重要通告]如您遇疑难杂症,本站支持知识付费业务,扫右边二维码加博主微信,可节省您宝贵时间哦!
清空iis log 中自己登录ip的vbs
XML/HTML代码
- 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
问题未解决?付费解决问题加Q或微信 2589053300 (即Q号又微信号)右上方扫一扫可加博主微信
所写所说,是心之所感,思之所悟,行之所得;文当无敷衍,落笔求简洁。 以所舍,求所获;有所依,方所成!
赏
支付宝赞助
微信赞助
免责声明,若由于商用引起版权纠纷,一切责任均由使用者承担。
您必须遵守我们的协议,如您下载该资源,行为将被视为对《免责声明》全部内容的认可->联系老梁投诉资源 LaoLiang.Net部分资源来自互联网收集,仅供用于学习和交流,请勿用于商业用途。如有侵权、不妥之处,请联系站长并出示版权证明以便删除。
敬请谅解! 侵权删帖/违法举报/投稿等事物联系邮箱:service@laoliang.net
意在交流学习,欢迎赞赏评论,如有谬误,请联系指正;转载请注明出处: » 清空iis log 中自己登录ip的vbs