When configuring a backup using Powershell in Windows 2016 Core, I am receiving an unintelligible exception.

I have created a backup policy as follows:

$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

If I print $policy to console, it reads:

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

But, when I call SetWBPolicy -Policy $policy it returns:

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

I have tried creating the policy using wbadmin but it fails with the equally vague statement The parameter is incorrect, which I guess is just a print-out of the same exception.

  • I wonder if it's seeing the spaces in the Volumes to Backup Parameter as separate volumes? – Davidw Aug 5 '18 at 5:58
  • @Davidw When creating the policy, the volumes were identified only by the drive letter. The label shown above is just an expanded view. I was completely stumped by this and didn't want to waste time on on it, so I have setup a backup script on the host hypervisor that suspends the VM and clones the virtual disk. I'll leave the question up in case someone can provide more information about this exception. – Marvin Aug 5 '18 at 15:02
  • How did you create the policy? – Davidw Aug 5 '18 at 20:51
  • @Davidw I've added the steps I used to create the policy. For the record, I can run a one-off backup fine using Start-WBBackup -Policy $policy. – Marvin Aug 5 '18 at 21:05
  • Hmm, sounds like it's not an issue with the policy itself, then. – Davidw Aug 6 '18 at 0:30

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.