Add-WBVirtualMachine

Add-WBVirtualMachine

Adds a list of virtual machines to the backup policy.

Syntax

Parameter Set: All
Add-WBVirtualMachine [-Policy] <WBPolicy> [[-All]] [-Confirm] [-WhatIf] [ <CommonParameters>]

Parameter Set: WBVirtualMachine
Add-WBVirtualMachine [-Policy] <WBPolicy> [[-VirtualMachine] <WBVirtualMachine[]> ] [-Confirm] [-WhatIf] [ <CommonParameters>]

Detailed Description

The Add-WBVirtualMachine cmdlet adds a list of virtual machines to a backup policy contained in the specified WBPolicy object.

Parameters

-All

Indicates that all virtual machines on the computer are added to the policy.

Aliases

none

Required?

false

Position?

2

Default Value

none

Accept Pipeline Input?

false

Accept Wildcard Characters?

false

-Policy<WBPolicy>

Specifies a WBPolicy object that contains the backup policy to update.

Aliases

none

Required?

true

Position?

1

Default Value

none

Accept Pipeline Input?

false

Accept Wildcard Characters?

false

-VirtualMachine<WBVirtualMachine[]>

Specifies an array of one or more virtual machines to add to the WBPolicy object.

Aliases

none

Required?

false

Position?

2

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.

Outputs

The output type is the type of the objects that the cmdlet emits.

Examples

Example 1: Add virtual machines to the backup policy

This example adds the list of volumes in the $VirtualMachines variable to the WBPolicy object $Policy.

The first command stores the result of the Get-WBPolicy cmdlet in the $Policy variable.

The second command stores the result of the Get-WBVirtualMachine cmdlet in the $VirtualMachines variable.

The third command adds the virtual machines listed in the $VirtualMachines variable to the backup policy in the $Policy variable.

PS C:\> $Policy = Get-WBPolicy
PS C:\> $VirtualMachines = Get-WBVirtualMachine
PS C:\> Add-WBVirtualMachine -Policy $Policy -VirtualMachine $VirtualMachines

Get-WBVirtualMachine

Remove-WBVirtualMachine