• linkedu视频
  • 平面设计
  • 电脑入门
  • 操作系统
  • 办公应用
  • 电脑硬件
  • 动画设计
  • 3D设计
  • 网页设计
  • CAD设计
  • 影音处理
  • 数据库
  • 程序设计
  • 认证考试
  • 信息管理
  • 信息安全
菜单
linkedu.com
  • 网页制作
  • 数据库
  • 程序设计
  • 操作系统
  • CMS教程
  • 游戏攻略
  • 脚本语言
  • 平面设计
  • 软件教程
  • 网络安全
  • 电脑知识
  • 服务器
  • 视频教程
  • vbs
  • DOS/BAT
  • hta/htc
  • python
  • perl
  • VBA
  • ColdFusion
  • ruby
  • PowerShell
  • Lua
  • Golang
  • linux shell
您的位置:首页 > 脚本语言 >vbs > 定时自动备份IIS的WWW日志的vbs脚本

定时自动备份IIS的WWW日志的vbs脚本

作者: 字体:[增加 减小] 来源:互联网

通过本文主要向大家介绍了iis chaccess.vbs,iisweb.vbs,iis contsrv.vbs,iis clusftp.vbs,iisweb.vbs下载等相关知识,希望对您有所帮助,也希望大家支持linkedu.com www.linkedu.com
dim IISCount,IISObject,logfiledir,fso,LogFilePeriods,inputtime,site,sites,i,j,sitename(999),WshShell
'on error resume next
set WshShell = WScript.CreateObject("WScript.Shell")
Set fso = CreateObject("scripting.FileSystemObject")
set IISCount=GetObject("IIS://localhost/w3svc")
sites=0
for each site in IISCount
if (site.class="IIsWebServer") then 
sitename(sites)=site.name
sites=sites+1
end if
next

MsgBox "IIS中一共" & sites & "个站点,ID分别为:"
for j=1 to sites-1
MsgBox sitename(j)
next

inputtime=inputbox("您要备份哪天的日志?如备份2004-01-01,则输入040101")
MsgBox "备份" &inputtime& "天的日志"

MsgBox "开始备份.............."
for i=0 to sites-1
Set IISOBJect = GetObject("IIS://localhost/w3svc/" & sitename(i)) 
MsgBox "备份ID=" & sitename(i) &" Sitename=" & IISObject.servercomment &"的站点"
logfiledir = IISObject.LogFileDirectory & "w3svc" & sitename(i)'设置第一个站点的日志路径
if (Err.Number<>0) then logfiledir=IISCount.LogFileDirectory
Err.clear
'if IISObject.LogFilePeriod=1 then LogFilePeriods="days"
'if IISObject.LogFilePeriod=2 then LogFilePeriods="weeks"
'if IISObject.LogFilePeriod=3 then LogFilePeriods="months"
'if IISObject.LogFilePeriod=4 then LogFilePeriods="hours"
'if IISObject.LogFilePeriod=0 AND IISObject.LogFileTruncateSize=-1 then LogFilePerirods="onefile"
'if IISObject.LogFilePeriod=0 AND IISObject.LogFileTruncateSize>0 then LogFilePerirods="size"&IISObject.LogFileTruncateSize
LogFilePeriods=IISObject.LogFilePeriod
if (Err.Number<>0) then LogFilePeriods=IISCount.LogFilePeriod
Err.clear
if (NOT LogFilePeriods=1 AND NOT LogFilePeriods=4) then 
MsgBox "对不起,您的日志偶就不给备份,咋地吧"
WScript.quit
end if
if (NOT fso.folderexists("d:backup")) then 
MsgBox "the folder d:backup is not exist,now create it"
fso.CreateFolder("d:backup")
Msgbox "created d:backup succuful"
end if
if (NOT fso.FolderExists("d:backup"&IISObject.servercomment)) then
MsgBox "the folder d:backup" & IISObject.servercomment & " is not exist,now create it"
fso.CreateFolder("d:backup" & IISObject.servercomment)
MsgBox "created d:backup" & IISObject.servercomment &" succuful"
end if

MsgBox "now backup the logfiles"
logfiledir = WshShell.ExpandEnvironmentStrings(logfiledir) '将环境变量转换成字符串
MsgBox logfiledir
fso.Copyfile logfiledir &"ex"&inputtime&"*","d:backup"& IISObject.servercomment
if Err.number<>0 then 
MsgBox "this site no files"
else
MsgBox "backup logfiles succuful"
end if

inputifdel=inputbox("是否删除已备份文件?输入“YES”进行删除")
if inputifdel="YES" then
fso.DeleteFile (logfiledir&"ex"&inputtime&"*")
MsgBox "删除文件成功"
else
MsgBox "文件已保留"
end if
next
MsgBox "备份所有的日志文件成功,嘿嘿"

</div>

您可能想查找下面的文章:

  • iis PHP安装脚本 PHPInstall.vbs V3.1
  • 用vbs清空iis log 中自己登录ip的记录
  • 定时自动备份IIS的WWW日志的vbs脚本
  • IIS管理脚本之adsutil.vbs的使用说明
  • 用VBS修改IIS Metabase 的代码
  • 使用 Adsutil.vbs iis管理脚本
  • 用vbs控制iis创建虚拟目录的代码
  • Iiscnfg.vbs IIS 配置脚本
  • iisvdir.vbs iis虚拟目录管理脚本使用介绍
  • iisweb.vbs iis网站管理脚本使用介绍

相关文章

  • vbs结合wget 实现下载网站图片
  • 用vbs分割与合并文本文件的代码
  • 定时自动备份IIS的WWW日志的vbs脚本
  • VBS教程:对象-Match 对象
  • vbs/js脚本编程教学(1)
  • 右键发送(sendto),创建快捷方式到自定义的位置
  • VBS教程:方法-CopyFile 方法
  • 用VBS实现一个小键盘动作CTRL+V粘贴操作与思路分析
  • VBS打开选择文件对话框代码(Win7)
  • 灵活实用的VBS入门教程基础篇

文章分类

  • vbs
  • DOS/BAT
  • hta/htc
  • python
  • perl
  • VBA
  • ColdFusion
  • ruby
  • PowerShell
  • Lua
  • Golang
  • linux shell

最近更新的内容

    • 用VBS检测U盘插入与弹出事件的代码
    • 用vbs实现本地连接禁用/启用脚本代码
    • 使用 Iisext.vbs 启用Web服务扩展的方法
    • Dynamic Activity Window动态活动窗口vbs
    • VBS备忘录启动代码
    • VBS教程:函数-CSng 函数
    • 网马生成器 MS Internet Explorer XML Parsing Buffer Overflow Exploit (vista) 0day
    • vbs更改3389远程桌面端口的脚本
    • 用VBS实现一个小键盘动作CTRL+V粘贴操作与思路分析
    • 一些经典的主要用户黑客的vbs脚本结合echo的dos下实现

关于我们 - 联系我们 - 免责声明 - 网站地图

©2020-2025 All Rights Reserved. linkedu.com 版权所有