激情久久久_欧美视频区_成人av免费_不卡视频一二三区_欧美精品在欧美一区二区少妇_欧美一区二区三区的

腳本之家,腳本語言編程技術及教程分享平臺!
分類導航

Python|VBS|Ruby|Lua|perl|VBA|Golang|PowerShell|Erlang|autoit|Dos|bat|

服務器之家 - 腳本之家 - VBS - 定時自動備份IIS的WWW日志的vbs腳本

定時自動備份IIS的WWW日志的vbs腳本

2020-07-15 11:03VBS腳本之家 VBS

本文主要分享定時自動備份IIS的WWW日志的vbs腳本,極具參考價值,有需要的朋友可以了解下

  1. dim IISCount,IISObject,logfiledir,fso,LogFilePeriods,inputtime,site,sites,i,j,sitename(999),WshShell  
  2. 'on error resume next  
  3. set WshShell = WScript.CreateObject("WScript.Shell")  
  4. Set fso = CreateObject("scripting.FileSystemObject")  
  5. set IISCount=GetObject("IIS://localhost/w3svc")  
  6. sites=0  
  7. for each site in IISCount  
  8. if (site.class="IIsWebServer") then   
  9. sitename(sites)=site.name  
  10. sites=sites+1  
  11. end if  
  12. next  
  13.  
  14. MsgBox "IIS中一共" & sites & "個站點,ID分別為:"  
  15. for j=1 to sites-1  
  16. MsgBox sitename(j)  
  17. next  
  18.  
  19. inputtime=inputbox("您要備份哪天的日志?如備份2004-01-01,則輸入040101")  
  20. MsgBox "備份" &inputtime& "天的日志"  
  21.  
  22. MsgBox "開始備份.............."  
  23. for i=0 to sites-1  
  24. Set IISOBJect = GetObject("IIS://localhost/w3svc/" & sitename(i))   
  25. MsgBox "備份ID=" & sitename(i) &" Sitename=" & IISObject.servercomment &"的站點"  
  26. logfiledir = IISObject.LogFileDirectory & "w3svc" & sitename(i)'設置第一個站點的日志路徑  
  27. if (Err.Number<>0) then logfiledir=IISCount.LogFileDirectory  
  28. Err.clear  
  29. 'if IISObject.LogFilePeriod=1 then LogFilePeriods="days"  
  30. 'if IISObject.LogFilePeriod=2 then LogFilePeriods="weeks"  
  31. 'if IISObject.LogFilePeriod=3 then LogFilePeriods="months"  
  32. 'if IISObject.LogFilePeriod=4 then LogFilePeriods="hours"  
  33. 'if IISObject.LogFilePeriod=0 AND IISObject.LogFileTruncateSize=-1 then LogFilePerirods="onefile"  
  34. 'if IISObject.LogFilePeriod=0 AND IISObject.LogFileTruncateSize>0 then LogFilePerirods="size"&IISObject.LogFileTruncateSize  
  35. LogFilePeriods=IISObject.LogFilePeriod  
  36. if (Err.Number<>0) then LogFilePeriods=IISCount.LogFilePeriod  
  37. Err.clear  
  38. if (NOT LogFilePeriods=1 AND NOT LogFilePeriods=4) then   
  39. MsgBox "對不起,您的日志偶就不給備份,咋地吧"  
  40. WScript.quit  
  41. end if  
  42. if (NOT fso.folderexists("d:backup")) then   
  43. MsgBox "the folder d:backup is not exist,now create it"  
  44. fso.CreateFolder("d:backup")  
  45. Msgbox "created d:backup succuful"  
  46. end if  
  47. if (NOT fso.FolderExists("d:backup"&IISObject.servercomment)) then  
  48. MsgBox "the folder d:backup" & IISObject.servercomment & " is not exist,now create it"  
  49. fso.CreateFolder("d:backup" & IISObject.servercomment)  
  50. MsgBox "created d:backup" & IISObject.servercomment &" succuful"  
  51. end if  
  52.  
  53. MsgBox "now backup the logfiles"  
  54. logfiledir = WshShell.ExpandEnvironmentStrings(logfiledir) '將環(huán)境變量轉換成字符串  
  55. MsgBox logfiledir  
  56. fso.Copyfile logfiledir &"ex"&inputtime&"*","d:backup"& IISObject.servercomment  
  57. if Err.number<>0 then   
  58. MsgBox "this site no files"  
  59. else  
  60. MsgBox "backup logfiles succuful"  
  61. end if  
  62.  
  63. inputifdel=inputbox("是否刪除已備份文件?輸入“YES”進行刪除")  
  64. if inputifdel="YES" then  
  65. fso.DeleteFile (logfiledir&"ex"&inputtime&"*")  
  66. MsgBox "刪除文件成功"  
  67. else  
  68. MsgBox "文件已保留"  
  69. end if  
  70. next  
  71. MsgBox "備份所有的日志文件成功,嘿嘿"  

延伸 · 閱讀

精彩推薦
主站蜘蛛池模板: 欧美成人午夜 | 久久视频国产 | 7m视频成人精品分类 | 免费黄色大片在线观看 | 国产三级国产精品国产普男人 | 99精品视频在线 | 国产精品欧美日韩一区二区 | 欧美人xx | 狠狠干91 | 亚洲自拍第一 | 欧美一a一片一级一片 | 成人免费观看49www在线观看 | 欧美1—12sexvideos| 九一看片.| 欧美wwwsss9999| 国产成人免费高清激情视频 | 噜噜噜躁狠狠躁狠狠精品视频 | 久久91亚洲人成电影网站 | 国产在线看片 | 激情亚洲一区二区三区 | 日本欧美一区二区三区在线观看 | 久久精品观看 | 欧美一级视频在线 | 欧美毛片在线观看 | 夜夜夜精品视频 | 87成人免费看片 | 91av在线免费播放 | 午夜男人在线观看 | av一二三四区 | 麻豆porn | 国产日韩在线观看视频 | 国产精品久久久久久久久久久久久久久 | 免费黄色小视频网站 | 久久精品成人免费国产片桃视频 | 撅高 自己扒开 调教 | 久久国产一级片 | 亚洲成人国产综合 | 免费观看三级毛片 | 免费在线观看一级片 | 男人午夜小视频 | 三人弄娇妻高潮3p视频 |