如何以编程方式进行Windows和数据备份

本文关键字:Windows 数据备份 方式进 编程 | 更新日期: 2023-09-27 18:30:39

我需要使用C#代码备份Windows数据及其设置。

为了实现目标,我正在运行以下命令:

Wbadmin start backup 

命令的来源

问题:

  1. 此命令不适用于所有版本的 Windows。

请求

有没有其他可靠的方法来备份Windows数据和设置。

如何以编程方式进行Windows和数据备份

Wbadmin 致力于:

视窗远景视窗服务器 2008视窗 7视窗 8视窗 10视窗服务器 2008 R2视窗服务器 2012

这是一个非常标准的推荐解决方案。除此之外,您还遇到了什么问题?

您应该能够从以下位置使用类似场景 #2 的内容:

https://technet.microsoft.com/en-us/library/cc742083(v=ws.11).aspx

wbadmin start backup –backupTarget:d: -include:g'folder1,h:'folder2 –systemstate -vsscopy

注意语法部分也是一个好主意

Windows

Vista 和 Windows Server 2008 的语法:

wbadmin start backup
[-backupTarget:{<BackupTargetLocation> | <TargetNetworkShare>}]
[-include:<VolumesToInclude>]
[-allCritical]
[-noVerify]
[-user:<UserName>]
[-password:<Password>]
[-noinheritAcl]
[-vssFull]
[-quiet]
Windows

7 和 Windows Server 2008 R2 及更高版本的语法:

Wbadmin start backup
[-backupTarget:{<BackupTargetLocation> | <TargetNetworkShare>}]
[-include:<ItemsToInclude>]
[-nonRecurseInclude:<ItemsToInclude>]
[-exclude:<ItemsToExclude>]
[-nonRecurseExclude:<ItemsToExclude>]
[-allCritical]
[-systemState]
[-noVerify]
[-user:<UserName>]
[-password:<Password>]
[-noInheritAcl]
[-vssFull | -vssCopy] 
[-quiet]

在某些情况下,您可能需要检测操作系统并运行wbadmin start systemstatebackup。您可能会注意到,Windows Vista 和 Windows Server 2008 中缺少 systemState 标志。同样重要的是要注意,wbadmin start systemstatebackup在 Windows 10 上不起作用,您将看到以下消息:

Warning:  The DELETE SYSTEMSTATEBACKUP command is not supported in this version of Windows.
The operation ended before completion.