Edit

Share via


Remove-WBPolicy

Removes the backup policy.

Syntax

Default (Default)

Remove-WBPolicy
    [[-Policy] <WBPolicy>]
    [-All]
    [-Force]
    [-WhatIf]
    [-Confirm]
    [<CommonParameters>]

Description

The Remove-WBPolicy cmdlet removes the WBPolicy object. This cmdlet stops scheduled daily backups from running. If the backup storage location is a disk, the cmdlet frees the disk. If the system does not have a scheduled backup, the cmdlet does not do anything.

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

Examples

Example 1: Remove all scheduled backups

PS C:\> Remove-WBPolicy -All -Force

This command removes the currently set WBPolicy object and disables all scheduled backups on the system. The command also uses the Force parameter to suppress the confirmation message.

Example 2: Remove a specified backup policy

PS C:\> $Policy = Get-WBPolicy
PS C:\> Remove-WBPolicy -Policy $Policy

This command store the result of the Get-WBPolicy cmdlet in the variable named $Policy, then removes the WBPolicy object, which disables all scheduled backups on the system.

Parameters

-All

Indicates that this cmdlet removes the WBPolicy object that is set in the system.

Parameter properties

Type:SwitchParameter
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

(All)
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-Confirm

Prompts you for confirmation before running the cmdlet.

Parameter properties

Type:SwitchParameter
Default value:False
Supports wildcards:False
DontShow:False
Aliases:cf

Parameter sets

(All)
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-Force

Forces the command to run without asking for user confirmation.

Parameter properties

Type:SwitchParameter
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

(All)
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-Policy

Specifies the backup policy object that this cmdlet updates.

Parameter properties

Type:WBPolicy
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

(All)
Position:0
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:True
Value from remaining arguments:False

-WhatIf

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

Parameter properties

Type:SwitchParameter
Default value:False
Supports wildcards:False
DontShow:False
Aliases:wi

Parameter sets

(All)
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

CommonParameters

This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutBuffer, -OutVariable, -PipelineVariable, -ProgressAction, -Verbose, -WarningAction, and -WarningVariable. For more information, see about_CommonParameters.

Inputs

Microsoft.Windows.ServerBackup.Commands.WBPolicy

Outputs

Object

Notes

  • The WBPolicy object must be in edit mode. To put the WBPolicy object in edit mode for a policy that is set as the scheduled backup policy, use the Get-WBPolicy cmdlet with the Editable parameter. The New-WBPolicy cmdlet creates a WBPolicy object that is already in edit mode.