创建并启用每日备份计划或修改现有备份计划。 如果未指定任何参数,则显示当前计划的备份设置。
To configure or modify a daily backup schedule using this command, you must be a member of the Backup Operators group or the Administrators group. In addition, you must run wbadmin from an elevated command prompt, by right-clicking Command Prompt, and then selecting Run as administrator.
若要查看磁盘的磁盘标识符值,请运行 wbadmin get disks 命令。
Syntax
wbadmin enable backup [-addtarget:<BackupTarget>] [-removetarget:<BackupTarget>] [-schedule:<TimeToRunBackup>] [-include:<VolumesToInclude>] [-nonRecurseInclude:<ItemsToInclude>] [-exclude:<ItemsToExclude>] [-nonRecurseExclude:<ItemsToExclude>][-systemState] [-hyperv:<HyperVComponentsToExclude>] [-allCritical] [-systemState] [-vssFull | -vssCopy] [-user:<UserName>] [-password:<Password>] [-allowDeleteOldBackups] [-quiet]
Parameters
Parameter | Description |
---|---|
-addtarget | 指定备份的存储位置。 要求将位置指定为远程共享文件夹 (UNC) 的磁盘、卷或通用命名约定 (\\<servername>\<sharename> UNC) 路径。 默认情况下,备份将保存到: \\<servername>\<sharename> WindowsImageBackup <ComputerBackedUp> 。 如果指定磁盘,则会在使用之前格式化磁盘,并且其上的任何现有数据将被永久擦除。 如果指定共享文件夹,则无法添加更多位置。 一次只能将一个共享文件夹指定为存储位置。Important: If you save a backup to a remote shared folder, that backup is overwritten if you use the same folder to back up the same computer again. 此外,如果备份作失败,则最终可能会没有备份,因为旧备份将被覆盖,但较新的备份将不可用。 可以通过在远程共享文件夹中创建子文件夹来组织备份来避免这种情况。 如果执行此作,子文件夹需要父文件夹的空间两倍。 单个命令中只能指定一个位置。 可以通过再次运行命令来添加多个卷和磁盘备份存储位置。 |
-removetarget | 指定要从现有备份计划中删除的存储位置。 要求将位置指定为磁盘标识符。 |
-schedule | 指定创建备份的一天中的时间,格式为 HH:MM 和逗号分隔。 |
-include | 指定要包含在备份中的项的逗号分隔列表。 可以包含多个文件、文件夹或卷。 可以使用卷驱动器号、卷装入点或基于 GUID 的卷名称来指定卷路径。 如果使用基于 GUID 的卷名称,它应以反斜杠结尾(\ )。 指定文件的路径时,可以在文件名中使用通配符 (* )。 |
-nonRecurseInclude | 指定要包含在备份中的项的非递归逗号分隔列表。 可以包含多个文件、文件夹或卷。 可以使用卷驱动器号、卷装入点或基于 GUID 的卷名称来指定卷路径。 如果使用基于 GUID 的卷名称,它应以反斜杠结尾(\ )。 指定文件的路径时,可以在文件名中使用通配符 (* )。 Should be used only when the -backupTarget parameter is used. |
-exclude | 指定要从备份中排除的以逗号分隔的项列表。 可以排除文件、文件夹或卷。 可以使用卷驱动器号、卷装入点或基于 GUID 的卷名称来指定卷路径。 如果使用基于 GUID 的卷名称,它应以反斜杠结尾(\ )。 指定文件的路径时,可以在文件名中使用通配符 (* )。 |
-nonRecurseExclude | 指定要从备份中排除的项的非递归逗号分隔列表。 可以排除文件、文件夹或卷。 可以使用卷驱动器号、卷装入点或基于 GUID 的卷名称来指定卷路径。 如果使用基于 GUID 的卷名称,它应以反斜杠结尾(\ )。 指定文件的路径时,可以在文件名中使用通配符 (* )。 |
-hyperv | 指定要包含在备份中的组件的逗号分隔列表。 标识符可以是组件名称或组件 GUID(带大括号或不带大括号)。 |
-systemState | Creates a backup that includes the system state in addition to any other items that you specified with the -include parameter. 系统状态包含启动文件(Boot.ini、NDTLDR、NTDetect.com)、Windows 注册表,包括 COM 设置、SYSVOL(组策略和登录脚本)、Active Directory 和 NTDS。域控制器上的 DIT,如果安装了证书服务,则证书存储。 如果服务器安装了 Web 服务器角色,将包含 IIS 元目录。 如果服务器是群集的一部分,则还会包含群集服务信息。 |
-allCritical | 指定备份中包含所有关键卷(包含作系统状态的卷)。 如果要为完整系统或系统状态恢复创建备份,此参数非常有用。 It should be used only when -backupTarget is specified; otherwise, the command fails. Can be used with the -include option. Tip: The target volume for a critical-volume backup can be a local drive, but it can't be any of the volumes that are included in the backup. |
-vssFull | 使用卷影复制服务(VSS)执行完全备份。 所有文件都已备份,每个文件的历史记录都会更新,以反映其已备份,并且以前的备份日志可能会被截断。 如果未使用此参数, wbadmin start backup 命令会进行复制备份,但要备份的文件历史记录不会更新。 Caution: Don't use this parameter if you're using a product other than Windows Server Backup to back up apps that are on the volumes included in the current backup. 这样做可能会破坏另一个备份产品正在创建的增量备份、差异备份或其他类型的备份,因为它们依赖的历史记录来确定备份可能丢失的数据量,并且可能会不必要地执行完整备份。 |
-vssCopy | 使用 VSS 执行复制备份。 所有文件都已备份,但正在备份的文件的历史记录不会更新,因此可以保留更改、删除等文件以及任何应用程序日志文件的所有信息。 使用此类型的备份不会影响可能与此复制备份无关的增量备份和差异备份序列。 这是默认值。 Warning: A backup copy can't be used for incremental or differential backups or restores. |
-user | 指定具有备份存储目标的写入权限的用户(如果是远程共享文件夹)。 The user needs to be a member of the Administrators or Backup Operators group on the computer getting backed up. |
-password | Specifies the password for the user name provided by the parameter -user. |
-allowDeleteOldBackups | 覆盖在升级计算机之前所做的任何备份。 |
-quiet | 在不提示用户的情况下运行该命令。 |
Examples
若要在上午 9:00 和下午 6:00 安排硬盘驱动器 E:、D:\mountpoint 以及 \\?\Volume{cc566d14-44a0-11d9-9d93-806e6f6e6963}\
将文件保存到名为 DiskID 的磁盘,请键入:
wbadmin enable backup -addtarget:DiskID -schedule:09:00,18:00 -include:E:,D:\mountpoint,\\?\Volume{cc566d14-44a0-11d9-9d93-806e6f6e6963}\
To schedule daily backups of the D:\documents folder at 12:00 AM and 7:00 PM to the network location \\backupshare\backup1
, using the network credentials for the Backup Operator, Aaren Ekelund (aekel), who's password is $3hM9^5lp and who is a member of the domain CONTOSOEAST, used to authenticate access to the network share, type:
wbadmin enable backup –addtarget:\\backupshare\backup1 –include: D:\documents –user:CONTOSOEAST\aekel –password:$3hM9^5lp –schedule:00:00,19:00
若要在上午 1:00 安排卷 T: 和 D:\documents 文件夹的每日备份,以驱动 H:,不包括该文件夹 d:\documents\~tmp
,并使用卷影复制服务执行完整备份,请键入:
wbadmin enable backup –addtarget:H: –include T:,D:\documents –exclude D:\documents\~tmp –vssfull –schedule:01:00