locked
Losing PreserveExistingBackups setting in Powershell script. RRS feed

  • Question

  • Hi all,

    I have a problem with my powershell script.
    I am trying to set up a backup with Windows Server Backup on a Windows Server 2012 R2.

    My script looks like this....

    Set-WBPerformanceConfiguration -OverAllPerformanceSetting AlwaysFull
    $policy = New-WBPolicy
    $disks = Get-WBDisk
    $backupLocation = New-WBBackupTarget - Disk $disks[12] -PreserveExistingBackups $true -Label "Backup"
    Add-WBBackupTarget -Policy $policy -Target $backupLocation

    If I singlestep the script and stop it after the $backupLocation variable is defined and print out its values, then I can see PreserveExistingBackups is set to true.
    If I let it run the last line the script then it makes a print out by itself and now PreserveExistingBackups is set to false.
    If I then again print out the values of $backupLocation, then it confirms that the PreserveExistingBackups indeed have changed to false.

    Why is this happening?
    Am I doing something wrong or is it a bug?

    Monday, September 11, 2017 4:00 AM

All replies

  • I suspect the documentation is wrong.

    Try:

    New-WBBackupTarget - Disk $disks[12] -PreserveExistingBackups:$true -Label Backup

    If this doesn't work then report it as a bug.


    \_(ツ)_/

    Monday, September 11, 2017 4:40 AM
  • Here are the rules for creating "preserved" backups:

    -PreserveExistingBackups<Boolean>

    Indicates whether the server saves copies of previous backups each time it performs a new backup.

    If you save a backup to a remote shared folder, the server overwrites that backup if you use the same folder to back up the same computer again. In addition, if the backup operation fails and the server overwrites the older backup, the newer backup will not be usable. To avoid this situation, specify this parameter, and create subfolders in the remote shared folder to organize your backups. If you do this, the subfolders need twice the space of the parent folder.


    \_(ツ)_/

    Monday, September 11, 2017 4:42 AM
  • Adding the colon did not change a thing. :(

    where do I report it as a bug?
    Monday, September 11, 2017 7:36 AM
  • Are you sure you are using separate subfolders for your backups?

    Report bugs to the PowerShell UserVoice site.


    \_(ツ)_/


    • Edited by jrv Monday, September 11, 2017 7:41 AM
    Monday, September 11, 2017 7:40 AM
  • Yeah, that one confuses me a bit.
    Its from here, I guess,

    https://technet.microsoft.com/en-us/library/jj873971(v=wps.630).aspxWhat

    In the syntax its listed only in combination with the -Disk option, but in the explanation its mentioning network shares.

    Monday, September 11, 2017 8:16 AM
  • I am using the -Disk option.
    Monday, September 11, 2017 8:17 AM
  • I have tried to report it as a bug, so lets see what happens.
    In my view Ps is bugged or the documentation is wrong. :)

    Monday, September 11, 2017 6:35 PM
  • Hi,

    I am checking how the issue is going, if you still have any questions, please feel free to contact us.

    Appreciate for your feedback.

    Best Regards,
    Albert Ling

    Please remember to mark the replies as an answers if they help and unmark them if they provide no help.
    If you have feedback for TechNet Subscriber Support, contact tnmff@microsoft.com.

    Friday, September 15, 2017 5:13 AM