佳木斯湛栽影视文化发展公司

主頁 > 知識庫 > 用vbs清空iis log 中自己登錄ip的記錄

用vbs清空iis log 中自己登錄ip的記錄

熱門標簽:銀行業(yè)務(wù) 檢查注冊表項 呼叫中心市場需求 智能手機 鐵路電話系統(tǒng) 服務(wù)器配置 網(wǎng)站文章發(fā)布 美圖手機
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ǎng)絡(luò)通訊聲明:本文標題《用vbs清空iis log 中自己登錄ip的記錄》,本文關(guān)鍵詞  ;如發(fā)現(xiàn)本文內(nèi)容存在版權(quán)問題,煩請?zhí)峁┫嚓P(guān)信息告之我們,我們將及時溝通與處理。本站內(nèi)容系統(tǒng)采集于網(wǎng)絡(luò),涉及言論、版權(quán)與本站無關(guān)。
  • 相關(guān)文章
  • 收縮
    • 微信客服
    • 微信二維碼
    • 電話咨詢

    • 400-1100-266
    杭锦旗| 察哈| 平顶山市| 睢宁县| 伊金霍洛旗| 东阳市| 吉首市| 昭平县| 三亚市| 郸城县| 婺源县| 张家港市| 昌都县| 怀化市| 宁陕县| 富锦市| 永兴县| 瑞安市| 漾濞| 旬阳县| 于都县| 农安县| 慈溪市| 五原县| 壶关县| 呼和浩特市| 神木县| 青田县| 乌兰察布市| 洛阳市| 尉氏县| 武邑县| 柳州市| 临洮县| 修武县| 天峨县| 乡宁县| 星座| 永城市| 吴忠市| 万州区|