Set-WBPolicy

Set-WBPolicy

Sets the WBPolicy object as the backup policy that will be used for scheduled backups.

Syntax

Set-WBPolicy [-Policy] <WBPolicy> [-Force] [<CommonParameters>]

Detailed Description

The Set-WBPolicy cmdlet sets the WBPolicy object as the backup policy that will be used for scheduled backups.

Parameters

-Force <SwitchParameter>

Specifies to not prompt the user for confirmation.

Attributes

Name Value

Required?

false

Accept wildcard characters?

false

Accept Pipeline Input?

false

Position?

named

-Policy <WBPolicy>

Specifies the backup policy (WBPolicy object) to update.

Attributes

Name Value

Required?

true

Accept wildcard characters?

false

Accept Pipeline Input?

true (ByPropertyName)

Position?

1

-CommonParameter

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

Input and Return Types

The input type is the type of the objects that you can pipe to the cmdlet. The return type is the type of the objects that the cmdlet emits.

Notes

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

  • To use Windows Server Backup cmdlets, you must be a member of the Administrators group or Backup Operators group.

Examples

EXAMPLE 1

C:\PS>$policy = New-WBPolicy 
 
$fileSpec = New-WBFileSpec -FileSpec C:\dir1 
Add-WBFileSpec -Policy $policy -FileSpec $filespec 
 
Add-WBBareMetalRecovery $policy 
 
$disks = Get-WBDisk 
$backupLocation = New-WBBackupTarget -Disk $disks[2] 
Add-WBBackupTarget -Policy $policy -Target $backupLocation 
 
Set-WBSchedule -Policy $policy 09:00 
 
Set-WBPolicy -Policy $policy

None

Description

-----------

Adds a file spec "C:\dir1" and ability to do bare metal recovery as the backup source, a disk as the backup location, and the daily schedule of 9:00 AM as the time for backup. The Set-WBPolicy cmdlet will format the disk and set the daily backup task.

EXAMPLE 2

C:\PS>$policy = Get-WBPolicy -Editable 
 
$backupLocation = New-WBBackupTarget -NetworkPath \\servername\share 
Add-WBBackupTarget -Policy $policy -Target $backupLocation 
 
Set-WBPolicy -Policy $policy

None

Description

-----------

Modifies the set WBPolicy object $policy. The backup location is changed to \\servername\share. You will be prompted to specify the credentials to access the remote shared folder and will be warned about choosing a remote shared folder as a backup storage location.

See Also

Reference

New-WBPolicy