Share via


Set-OBPolicyState

Sets the PolicyState of the current backup policy object. The state can be either Valid or Paused.

Syntax

Set-OBPolicyState
   [-Policy] <CBPolicy>
   [-State] <OMPolicyStates>
   [-Confirm]
   [-WhatIf]

Description

This cmdlet can be used to set the current state of the backup policy. The state can be either Valid or Paused.

A Valid state means that the backups will happen based on the defined schedule and that backups will be retained based on the retention policy.

A Paused state means that backups will not occur according to the defined schedule that the current backups will be retained until the backup policy is changed to Valid state or is deleted.

Examples

EXAMPLE 1

$P = Get-OBPolicy
 Set-OBPolicyState   $P "Valid"
 Set-OBPolicy   $P

This example sets the OBPolicyState to Valid and updates the OBPolicy object.

EXAMPLE 2

$P = Get-OBPolicy
 Set-OBPolicyState   $P "Paused"
 Set-OBPolicy   $P

This example sets the OBPolicyState to Paused and updates the OBPolicy object.

EXAMPLE 3

Get-OBPolicy | Set-OBPolicyState -State "Paused" | Set-OBPolicy

This example sets the OBPolicyState to Paused and updates the OBPolicy object using pipelines.

Parameters

-Confirm

Prompts you for confirmation before running the cmdlet.

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

-Policy

Specifies the backup policy (OBPolicy) object on which to set the PolicyState.

Type:CBPolicy
Position:2
Default value:None
Required:True
Accept pipeline input:True
Accept wildcard characters:False

-State

The current PolicyState of the backup policy.

Type:OMPolicyStates
Position:3
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
Position:Named
Default value:False
Required:False
Accept pipeline input:False
Accept wildcard characters:False

Inputs

Microsoft.Internal.CloudBackup.Commands.OBPolicy

Outputs

Microsoft.Internal.CloudBackup.Commands.OBPolicyState