清空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