清空iis log 中自己登錄ip的vbs
[重要通告]如您遇疑難雜癥,本站支持知識(shí)付費(fèi)業(yè)務(wù),掃右邊二維碼加博主微信,可節(jié)省您寶貴時(shí)間哦!
清空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
問(wèn)題未解決?付費(fèi)解決問(wèn)題加Q或微信 2589053300 (即Q號(hào)又微信號(hào))右上方掃一掃可加博主微信
所寫(xiě)所說(shuō),是心之所感,思之所悟,行之所得;文當(dāng)無(wú)敷衍,落筆求簡(jiǎn)潔。 以所舍,求所獲;有所依,方所成!
賞
支付寶贊助
微信贊助
免責(zé)聲明,若由于商用引起版權(quán)糾紛,一切責(zé)任均由使用者承擔(dān)。
您必須遵守我們的協(xié)議,如您下載該資源,行為將被視為對(duì)《免責(zé)聲明》全部?jī)?nèi)容的認(rèn)可->聯(lián)系老梁投訴資源 LaoLiang.Net部分資源來(lái)自互聯(lián)網(wǎng)收集,僅供用于學(xué)習(xí)和交流,請(qǐng)勿用于商業(yè)用途。如有侵權(quán)、不妥之處,請(qǐng)聯(lián)系站長(zhǎng)并出示版權(quán)證明以便刪除。
敬請(qǐng)諒解! 侵權(quán)刪帖/違法舉報(bào)/投稿等事物聯(lián)系郵箱:service@laoliang.net
意在交流學(xué)習(xí),歡迎贊賞評(píng)論,如有謬誤,請(qǐng)聯(lián)系指正;轉(zhuǎn)載請(qǐng)注明出處: » 清空iis log 中自己登錄ip的vbs