Remove-WBFileSpec
Remove-WBFileSpec
Removes a backup file specification from a backup policy.
Syntax
Parameter Set: Default
Remove-WBFileSpec [-Policy] <WBPolicy> [-FileSpec] <WBFileSpec> [-Confirm] [-WhatIf] [ <CommonParameters>]
Detailed 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 Windows Server® 2012 Backup cmdlets, you must be a member of the Administrators group or Backup Operators group.
Parameters
-FileSpec<WBFileSpec>
Specifies a backup file specification object to remove from the WBPolicy object.
Aliases |
none |
Required? |
true |
Position? |
2 |
Default Value |
none |
Accept Pipeline Input? |
True (ByValue) |
Accept Wildcard Characters? |
false |
-Policy<WBPolicy>
Specifies a backup policy object that contains the backup policy to update.
Aliases |
none |
Required? |
true |
Position? |
1 |
Default Value |
none |
Accept Pipeline Input? |
True (ByValue) |
Accept Wildcard Characters? |
false |
-Confirm
Prompts you for confirmation before running the cmdlet.
Required? |
false |
Position? |
named |
Default Value |
false |
Accept Pipeline Input? |
false |
Accept Wildcard Characters? |
false |
-WhatIf
Shows what would happen if the cmdlet runs. The cmdlet is not run.
Required? |
false |
Position? |
named |
Default Value |
false |
Accept Pipeline Input? |
false |
Accept Wildcard Characters? |
false |
<CommonParameters>
This cmdlet supports the common parameters: -Verbose, -Debug, -ErrorAction, -ErrorVariable, -OutBuffer, and -OutVariable. For more information, see about_CommonParameters (https://go.microsoft.com/fwlink/p/?LinkID=113216).
Inputs
The input type is the type of the objects that you can pipe to the cmdlet.
WBFileSpec, WBPolicy
The Remove-WBFileSpec cmdlet removes a WBFileSpec object from a WBPolicy object.
Outputs
The output type is the type of the objects that the cmdlet emits.
None
None
Examples
Example 1: Remove a backup file specification from a backup policy
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 in $Policy.
PS C:\> $Filespeclist = Get-WBFileSpec -Policy $policy
PS C:\> Remove-WBFileSpec -Policy $policy -FileSpec $Filespeclist[1]
None