首页脚本用vbs清空iis log 中自己登录ip的记录

用vbs清空iis log 中自己登录ip的记录

时间2024-02-11 10:21:02发布访客分类脚本浏览1033
导读:收集整理的这篇文章主要介绍了用vbs清空iis log 中自己登录ip的记录,觉得挺不错的,现在分享给大家,也给大家做个参考。 Option ExplicIT Dim sourcefi...
收集整理的这篇文章主要介绍了用vbs清空iis log 中自己登录ip的记录,觉得挺不错的,现在分享给大家,也给大家做个参考。 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

声明:本文内容由网友自发贡献,本站不承担相应法律责任。对本内容有异议或投诉,请联系2913721942#qq.com核实处理,我们将尽快回复您,谢谢合作!


若转载请注明出处: 用vbs清空iis log 中自己登录ip的记录
本文地址: https://pptw.com/jishu/609672.html
用vbs实现判断计算机是笔记本还是台式机的代码 vbs sendmail发邮件带附件方法

游客 回复需填写必要信息