Add-WssBackupTarget

Adds a backup target to a scheduled backup.

Syntax

Add-WssBackupTarget
   [-BackupPolicy] <ScheduledBackupPolicy>
   [-BackupTarget] <BackupTarget>
   [-Force]
   [<CommonParameters>]

Description

The Add-WssBackupTarget cmdlet adds a backup target to a scheduled backup policy. A scheduled backup policy is a backup file specification that has a backup schedule associated with it. When you add a backup target to the backup policy, the backup job adds the files in the backup policy that you specify to the new target location.

Examples

Example 1: Add a backup target to a scheduled backup policy

PS C:\>$ContosoBUPolicy213 = Get-WssBackupPolicy
PS C:\> $ContosoBUTarget05 = New-WBBackupTarget -VolumePath "F:\"
PS C:\> Add-WssBackupTarget -BackupPolicy $ContosoBUPolicy213 -BackupTarget $ContosoBUTarget05

This example adds a backup target to a backup policy.

The first command gets the current backup policy for the computer and stores it in the variable named $ContosoBUPolicy213.

The second command creates a new backup target from the volume on drive F: and stores it in the variable named $ContosoBUTarget05.

The third command adds the backup target that is stored in $ContosoBUTarget05 to the backup policy that is stored in $ContosoBUPolicy213.

Parameters

-BackupPolicy

Specifies the scheduled backup policy to which to add the backup target.

Type:ScheduledBackupPolicy
Position:0
Default value:None
Required:True
Accept pipeline input:True
Accept wildcard characters:False

-BackupTarget

Specifies the backup target to add.

Type:BackupTarget
Position:1
Default value:None
Required:True
Accept pipeline input:True
Accept wildcard characters:False

-Force

Forces the command to run without asking for user confirmation.

Type:SwitchParameter
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False

Outputs

Microsoft.WindowsServerSolutions.DataProtection.ServerBackup.ObjectModel.BackupTarget

This cmdlet returns the list of backup targets.