在 Windows 2016 Core 中使用 Powershell 配置备份时,我收到了难以理解的异常。
我创建了如下备份策略:
$policy = New-WBPolicy
Add-WBBareMetalRecovery -Policy $policy
Add-WBSystemState -Policy $policy
$volumes = Get-WBVolume -VolumePath "C:"
Add-WBVolume -Policy $policy -Volume $volumes
$creds = Get-Credential
$target = New-WBBackupTarget -NetworkPath "\\some\network\path" -Credential $creds
Add-WBBackupTarget -Policy $policy -Target $target
Set-WBSchedule -Policy $policy -Schedule 06:00
Set-WBPolicy -Policy $policy
如果我打印$policy
到控制台,它会显示:
Schedule : {05/08/2018 06:00:00}
BackupTargets : {\\some\network\path}
VolumesToBackup : {Local disk (C:)}
FilesSpecsToBackup :
FilesSpecsToBackup :
ComponentsToBackup :
BMR : True
SystemState : True
OverwriteOldFormatVhd : True
VssBackupOptions : VssCopyBackup
但是,当我调用SetWBPolicy -Policy $policy
它时返回:
Set-WBPolicy : The parameter is incorrect
At line:1 char:1
+ Set-WBPolicy -Policy $policy
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : NotSpecified: (:) [Set-WBPolicy], Exception
+ FullyQualifiedErrorId : System.Exception,Microsoft.Windows.ServerBackup.Commands.SetWBPolicy
我曾尝试使用该策略创建策略wbadmin
,但它因同样模糊的声明而失败The parameter is incorrect
,我猜这只是相同异常的打印输出。