- 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
清空iis log 中自己登录ip的vbs
2019-11-01 12:48asp教程网 ASP教程
清空iis log 中自己登录ip的vbs
延伸 · 阅读
- 2022-03-09Python Log文件大小设置及备份的方法
- 2022-03-05sqlserver数据库加密后无法使用MDF,LDF,log文件名称被
- 2022-03-02windows server 2019开启iis服务器+tp5.1的完美配置运行
- 2022-02-21C#部署数据库及IIS站点
- 2022-02-20Windows Server 2012 安装配置IIS图文教程
- 2022-02-13Windows Sever IIS定时重启工具 v1.0绿色版
精彩推荐
- ASP教程
asp+javascript实现404页的处理转换
asp+javascript实现404页的处理转换...
- ASP教程
ASP.NET 数据源
数据源 一个 data sourse 控件与数据绑定的控件相互作用,并隐藏了复杂的数据的联编过程。这些是提供数据给 data bound 控件的工具,并且支持如插入,删除...
- ASP教程
asp之基于adodb.stream的文件操作类
asp之基于adodb.stream的文件操作类...
- ASP教程
asp 标记字符串中指定字符变色不区分大小写
今天遇到这种问题,单纯的使用replace函数不行,他会改变原有的字符串的大小写,在网上找到相关的代码,自己备份下...
- ASP教程
asp Access数据备份,还原,压缩类代码
asp Access数据备份,还原,压缩类实现代码,大家可以参考下。...
- ASP教程
JScript中遍历Request表单参数集合的方法
这篇文章主要介绍了JScript中遍历Request表单参数集合的方法,本文以遍历Request.QueryString集合为例给出了实现代码,需要的朋友可以参考下...
- ASP教程
ASP常用函数:getpy()
ASP常用函数:getpy()...
- ASP教程
asp 采集实战代码
最近实在是太流行采集了,本人是不喜欢采集的,但对采集的原理我却很有兴趣进行研究,拿到了网上采集常用函数,对其进行了一番研究,并实战,结果...