Remove-WBFileSpec

Removes a backup file specification from a backup policy.

Syntax

Remove-WBFileSpec
      [-Policy] <WBPolicy>
      [-FileSpec] <WBFileSpec>
      [-WhatIf]
      [-Confirm]
      [<CommonParameters>]

Description

The Remove-WBFileSpec cmdlet removes a WBFileSpec object that contains a backup file specification from a WBPolicy object that contains a backup policy. A backup file specification contains a list of items to include in or exclude from backups that use the backup policy.

Before you can remove a backup file specification from a WBPolicy object, you must put the WBPolicy object in edit mode. To put the WBPolicy object in edit mode for a policy that you set as the scheduled backup policy, use the Get-WBPolicy cmdlet with the Editable parameter. The New-WBPolicy cmdlet creates a new WBPolicy object that is already in edit mode.

To use this cmdlet, you must be a member of the Administrators group or Backup Operators group.

Examples

Example 1: Remove a backup file specification from a backup policy

PS C:\> $Filespeclist = Get-WBFileSpec -Policy $Policy
PS C:\> Remove-WBFileSpec -Policy $Policy -FileSpec $Filespeclist[1]

This example removes a backup file specification from a backup policy.

The first command gets a list of the backup file specifications from the backup policy in the variable named $Policy. The command assigns the backup file specifications to the array in the variable named $Filespeclist.

The second command removes the backup file specification in the first element of $Filespeclist from the policy stored in the $Policy variable.

Parameters

-Confirm

Prompts you for confirmation before running the cmdlet.

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

-FileSpec

Specifies a backup file specification object to remove from the WBPolicy object.

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

-Policy

Specifies a backup policy object that contains the backup policy that this cmdlet updates.

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

-WhatIf

Shows what would happen if the cmdlet runs. The cmdlet is not run.

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

Inputs

Microsoft.Windows.ServerBackup.Commands.WBPolicy

Microsoft.Windows.ServerBackup.Commands.WBFileSpec

This cmdlet removes a WBFileSpec object from a WBPolicy object.

Outputs

Object