Merge pull request #102 from ZertoPublic/Add-VMToVpg
Add-ZertoVpgVm and Remove-ZertoVpgVm
This commit is contained in:
@@ -6,3 +6,4 @@ SourceTestResults.xml
|
||||
publish/*
|
||||
CodeCoverage.xml
|
||||
scratch
|
||||
.DS_Store
|
||||
|
||||
@@ -5,6 +5,15 @@ All notable changes to this project will be documented in this file.
|
||||
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
|
||||
and this project is transitioning to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
||||
|
||||
## Unreleased
|
||||
|
||||
### Zerto Virtual Manager
|
||||
|
||||
#### New
|
||||
|
||||
* Added `Add-ZertoVpgVm` function to the module. Read the [help file](https://github.com/ZertoPublic/ZertoApiWrapper/blob/master/docs/Add-ZertoVpgVm.md) for more information.
|
||||
* Added `Remove-ZertoVpgVm` function to the module. Read the [help file](https://github.com/ZertoPublic/ZertoApiWrapper/blob/master/docs/Remove-ZertoVpgVm.md) for more information.
|
||||
|
||||
## [1.4.3]
|
||||
|
||||
### Zerto Virtual Manager
|
||||
|
||||
@@ -0,0 +1,53 @@
|
||||
#Requires -Modules Pester
|
||||
$global:here = (Split-Path -Parent $PSCommandPath)
|
||||
$global:function = ((Split-Path -Leaf $PSCommandPath).Split('.'))[0]
|
||||
|
||||
Describe $global:function -Tag 'Unit', 'Source', 'Built' {
|
||||
BeforeAll {
|
||||
$script:ScriptBlock = (Get-Command $global:function).ScriptBlock
|
||||
}
|
||||
|
||||
Context "$global:function::Parameter Unit Tests" {
|
||||
|
||||
It "$global:function should have exactly 16 parameters defined" {
|
||||
(Get-Command $global:function).Parameters.Count | Should -Be 16
|
||||
}
|
||||
|
||||
$ParameterTestCases = @(
|
||||
@{ParameterName = 'vpgSettingsIdentifier'; Type = 'String'; Mandatory = $true; Validation = 'NotNullOrEmpty' }
|
||||
@{ParameterName = 'Vm'; Type = 'String[]'; Mandatory = $true; Validation = 'NotNullOrEmpty' }
|
||||
@{ParameterName = 'VpgName'; Type = 'String'; Mandatory = $true; Validation = 'NotNullOrEmpty' }
|
||||
)
|
||||
|
||||
It "<ParameterName> parameter is of <Type> type" -TestCases $ParameterTestCases {
|
||||
param($ParameterName, $Type, $Mandatory, $Validation)
|
||||
Get-Command $global:function | Should -HaveParameter $ParameterName -Mandatory:$Mandatory -Type $Type
|
||||
}
|
||||
|
||||
It "<ParameterName> parameter has correct validation setting" -TestCases $ParameterTestCases {
|
||||
param($ParameterName, $Validation)
|
||||
Switch ($Validation) {
|
||||
'NotNullOrEmpty' {
|
||||
$attrs = (Get-Command $global:function).Parameters[$ParameterName].Attributes
|
||||
$attrs.Where{ $_ -is [ValidateNotNullOrEmpty] }.Count | Should -Be 1
|
||||
}
|
||||
|
||||
default {
|
||||
$true | Should -Be $false -Because "No Validation Selected. Review test cases"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
It "Supports 'SupportsShouldProcess'" {
|
||||
Get-Command $global:function | Should -HaveParameter WhatIf
|
||||
Get-Command $global:function | Should -HaveParameter Confirm
|
||||
$script:ScriptBlock | Should -Match 'SupportsShouldProcess'
|
||||
$script:ScriptBlock | Should -Match '\$PSCmdlet\.ShouldProcess\(.+\)'
|
||||
}
|
||||
}
|
||||
|
||||
Context "Add-ZertoPeerSite::Functional Unit Tests" {
|
||||
}
|
||||
}
|
||||
Remove-Variable -Name here -Scope Global
|
||||
Remove-Variable -Name function -Scope Global
|
||||
@@ -0,0 +1,52 @@
|
||||
#Requires -Modules Pester
|
||||
$global:here = (Split-Path -Parent $PSCommandPath)
|
||||
$global:function = ((Split-Path -Leaf $PSCommandPath).Split('.'))[0]
|
||||
|
||||
Describe $global:function -Tag 'Unit', 'Source', 'Built' {
|
||||
BeforeAll {
|
||||
$script:ScriptBlock = (Get-Command $global:function).ScriptBlock
|
||||
}
|
||||
|
||||
Context "$global:function::Parameter Unit Tests" {
|
||||
|
||||
It "$global:function should have exactly 15 parameters defined" {
|
||||
(Get-Command $global:function).Parameters.Count | Should -Be 15
|
||||
}
|
||||
|
||||
$ParameterTestCases = @(
|
||||
@{ParameterName = 'Vm'; Type = 'String[]'; Mandatory = $true; Validation = 'NotNullOrEmpty' }
|
||||
@{ParameterName = 'VpgName'; Type = 'String'; Mandatory = $true; Validation = 'NotNullOrEmpty' }
|
||||
)
|
||||
|
||||
It "<ParameterName> parameter is of <Type> type" -TestCases $ParameterTestCases {
|
||||
param($ParameterName, $Type, $Mandatory, $Validation)
|
||||
Get-Command $global:function | Should -HaveParameter $ParameterName -Mandatory:$Mandatory -Type $Type
|
||||
}
|
||||
|
||||
It "<ParameterName> parameter has correct validation setting" -TestCases $ParameterTestCases {
|
||||
param($ParameterName, $Validation)
|
||||
Switch ($Validation) {
|
||||
'NotNullOrEmpty' {
|
||||
$attrs = (Get-Command $global:function).Parameters[$ParameterName].Attributes
|
||||
$attrs.Where{ $_ -is [ValidateNotNullOrEmpty] }.Count | Should -Be 1
|
||||
}
|
||||
|
||||
default {
|
||||
$true | Should -Be $false -Because "No Validation Selected. Review test cases"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
It "Supports 'SupportsShouldProcess'" {
|
||||
Get-Command $global:function | Should -HaveParameter WhatIf
|
||||
Get-Command $global:function | Should -HaveParameter Confirm
|
||||
$script:ScriptBlock | Should -Match 'SupportsShouldProcess'
|
||||
$script:ScriptBlock | Should -Match '\$PSCmdlet\.ShouldProcess\(.+\)'
|
||||
}
|
||||
}
|
||||
|
||||
Context "Add-ZertoPeerSite::Functional Unit Tests" {
|
||||
}
|
||||
}
|
||||
Remove-Variable -Name here -Scope Global
|
||||
Remove-Variable -Name function -Scope Global
|
||||
@@ -0,0 +1,104 @@
|
||||
<# .ExternalHelp ./en-us/ZertoApiWrapper-help.xml #>
|
||||
function Add-ZertoVpgVm {
|
||||
[CmdletBinding(SupportsShouldProcess, DefaultParameterSetName = "VpgName")]
|
||||
param (
|
||||
[Parameter(
|
||||
Mandatory,
|
||||
HelpMessage = "Vpg Settings Identifier",
|
||||
ValueFromPipeline,
|
||||
ValueFromPipelineByPropertyName,
|
||||
ValueFromRemainingArguments,
|
||||
ParameterSetName = "VpgSettingsIdentifier"
|
||||
)]
|
||||
[ValidateNotNullOrEmpty()]
|
||||
[Alias("sid", "settingsIdentifier", "vpgSettingsId")]
|
||||
[String]$vpgSettingsIdentifier,
|
||||
[Parameter(
|
||||
Mandatory,
|
||||
HelpMessage = "Target VPG Name to Add the VM",
|
||||
ParameterSetName = "VpgName"
|
||||
)]
|
||||
[ValidateNotNullOrEmpty()]
|
||||
[String]$VpgName,
|
||||
[Parameter(
|
||||
Mandatory,
|
||||
HelpMessage = "Name of VM(s) to add to the VPG"
|
||||
)]
|
||||
[ValidateNotNullOrEmpty()]
|
||||
[String[]]$Vm
|
||||
)
|
||||
|
||||
begin {
|
||||
|
||||
}
|
||||
|
||||
process {
|
||||
if ($PSCmdlet.ParameterSetName -eq "VpgName") {
|
||||
$VpgIdentifier = Get-ZertoVpg -name $VpgName | Select-Object -ExpandProperty VpgIdentifier
|
||||
if (-not $VpgIdentifier) {
|
||||
Write-Error "Unable to find Vpg with name $VpgName. Please check your parameters and try again." -ErrorAction Stop
|
||||
} else {
|
||||
$vpgSettingsIdentifier = New-ZertoVpgSettingsIdentifier -vpgIdentifier $VpgIdentifier
|
||||
}
|
||||
}
|
||||
$baseUrl = "vpgsettings/{0}/vms" -f $vpgSettingsIdentifier
|
||||
$baseSettings = Get-ZertoVpgSetting -vpgSettingsIdentifier $vpgSettingsIdentifier
|
||||
if ($PSCmdlet.ParameterSetName -eq "VpgSettingsIdentifier") {
|
||||
$VpgName = $baseSettings.Basic.Name
|
||||
}
|
||||
$unprotectedVms = Get-ZertoUnprotectedVm
|
||||
$protectedVms = Get-ZertoProtectedVm
|
||||
$vmMap = Get-Map -inputObject $unprotectedVms -key VmName -value VmIdentifier
|
||||
$vmMap = $vmMap + (Get-Map -inputObject $protectedVms -key VmName -value VmIdentifier)
|
||||
# Create array of VM identifiers
|
||||
$vmIdentifiers = foreach ($machine in ($Vm | Select-Object -Unique)) {
|
||||
if ($vmMap[$machine] -notin $baseSettings.Vms.vmIdentifier ) {
|
||||
# If the VM is unprotected, get the identifier
|
||||
$vmIdentifier = $unprotectedVms | Where-Object { $_.vmName -like $machine } | Select-Object -ExpandProperty vmIdentifier
|
||||
# If the VM is not unprotected, check the protected VMs
|
||||
if ( -not $vmIdentifier) {
|
||||
# Get all identifiers to test if the VM is eligible to be a member of an additional VPG
|
||||
$results = $protectedVms | Where-Object { $_.VmName -like $machine } | Select-Object -ExpandProperty vmIdentifier
|
||||
$recoverySiteIdentifiers = $protectedVms | Where-Object { $_.VmName -like $machine } | Select-Object -ExpandProperty RecoverySite | Select-Object -ExpandProperty identifier
|
||||
# If VM is currently a member of 3 VPGs, skip it. If it cannot be found, skip it. Otherwise, set the identifier
|
||||
if ($baseSettings.basic.RecoverySiteIdentifier -in $recoverySiteIdentifiers) {
|
||||
Write-Warning "$machine is already replicating to target site. It cannot be added to an additional VPG replicating to that site. Please check your configurations and try again. Skipping $machine"
|
||||
continue
|
||||
} elseif ($results.count -eq 3) {
|
||||
Write-Warning "$machine is already a part of 3 VPGs and cannot be part of an additional VPG. Skipping $machine"
|
||||
continue
|
||||
} elseif ($results.count -eq 0) {
|
||||
Write-Warning "$machine not found. Skipping $machine"
|
||||
continue
|
||||
} else {
|
||||
$vmIdentifier = $results | Select-Object -First 1
|
||||
}
|
||||
}
|
||||
# Create a custom object to store the information to easily convert to JSON. Return to vmIdentifiers array.
|
||||
$vmIdentifier
|
||||
} else {
|
||||
Write-Warning "$machine is already a member of this VPG Settings object. It will not be added again. Skipping $machine"
|
||||
continue
|
||||
}
|
||||
}
|
||||
if ($vmIdentifiers.Count -gt 0 -and $PSCmdlet.ShouldProcess($VmIdentifiers, "Adding VM(s): $Vm to Vpg $VpgName")) {
|
||||
foreach ($id in $VmIdentifiers) {
|
||||
# Build the Body
|
||||
$Body = @{VmIdentifier = $id }
|
||||
# Submit the request. Out to Null to prevent line returns while running.
|
||||
$null = Invoke-ZertoRestRequest -uri $baseUrl -method POST -body ($Body | ConvertTo-Json -Depth 10)
|
||||
}
|
||||
|
||||
$vpgSettingsIdentifier
|
||||
} else {
|
||||
Write-Warning "No VMs found to add. Please check your parameters and try again."
|
||||
if ($PSCmdlet.ParameterSetName -eq "VpgName") {
|
||||
Remove-ZertoVpgSettingsIdentifier -vpgSettingsIdentifier $vpgSettingsIdentifier
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
end {
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,53 @@
|
||||
<# .ExternalHelp ./en-us/ZertoApiWrapper-help.xml #>
|
||||
function Remove-ZertoVpgVm {
|
||||
[CmdletBinding(SupportsShouldProcess, ConfirmImpact = "High")]
|
||||
param (
|
||||
[Parameter(
|
||||
Mandatory,
|
||||
HelpMessage = "Name of the VPG that contains the VM you wish to remove",
|
||||
ParameterSetName = "VpgName"
|
||||
)]
|
||||
[ValidateNotNullOrEmpty()]
|
||||
[String]$VpgName,
|
||||
[Parameter(
|
||||
Mandatory,
|
||||
HelpMessage = "Name of VM(s) to remove from the VPG"
|
||||
)]
|
||||
[ValidateNotNullOrEmpty()]
|
||||
[String[]]$Vm
|
||||
)
|
||||
|
||||
begin {
|
||||
|
||||
}
|
||||
|
||||
process {
|
||||
$VpgData = Get-ZertoVpg -vpgName $VpgName
|
||||
if (-not $VpgData) {
|
||||
Write-Error "Unable to find Vpg with name $VpgName. Please check your parameters and try again." -ErrorAction Stop
|
||||
} else {
|
||||
$protectedVms = Get-ZertoProtectedVm -vpgName $VpgData.VpgName
|
||||
}
|
||||
$VmIdentifiers = foreach ($machine in ($vm | Select-Object -Unique)) {
|
||||
if ($machine -in $protectedVms.VmName) {
|
||||
$protectedVms.Where( { $_.VmName -like $machine }) | Select-Object -ExpandProperty VmIdentifier
|
||||
} else {
|
||||
Write-Warning "Virtual Machine: '$machine' is not found in Vpg: '$VpgName'. Check your parameters. Skipping $machine"
|
||||
}
|
||||
}
|
||||
if ($VmIdentifiers.Count -gt 0 -and $PSCmdlet.ShouldProcess(($Vm | Select-Object -Unique), "Removing VM(s): $($Vm | Select-Object -Unique) from Vpg $VpgName")) {
|
||||
$vpgSettingsIdentifier = New-ZertoVpgSettingsIdentifier -vpgIdentifier $VpgData.VpgIdentifier
|
||||
foreach ($identifier in $VmIdentifiers) {
|
||||
$url = "vpgSettings/{0}/vms/{1}" -f $vpgSettingsIdentifier, $identifier
|
||||
Invoke-ZertoRestRequest -uri $url -method DELETE
|
||||
}
|
||||
Save-ZertoVpgSetting -vpgSettingsIdentifier $vpgSettingsIdentifier
|
||||
} else {
|
||||
Write-Warning "No VMs found to remove. Please check your parameters and try again."
|
||||
}
|
||||
}
|
||||
|
||||
end {
|
||||
|
||||
}
|
||||
}
|
||||
@@ -11,7 +11,7 @@ function Save-ZertoVpgSetting {
|
||||
ValueFromPipelineByPropertyName = $true
|
||||
)]
|
||||
[ValidateNotNullOrEmpty()]
|
||||
[Alias("vpgSettingsId")]
|
||||
[Alias("sid", "settingsIdentifier", "vpgSettingsId")]
|
||||
[string]$vpgSettingsIdentifier
|
||||
)
|
||||
|
||||
|
||||
@@ -0,0 +1,138 @@
|
||||
---
|
||||
external help file: ZertoApiWrapper-help.xml
|
||||
Module Name: ZertoApiWrapper
|
||||
online version: https://github.com/ZertoPublic/ZertoApiWrapper/blob/master/docs/Add-ZertoVpgVm.md
|
||||
schema: 2.0.0
|
||||
---
|
||||
|
||||
# Add-ZertoVpgVm
|
||||
|
||||
## SYNOPSIS
|
||||
Adds one or more virtual machines to an existing VPG. A VPG Settings Identifier will be returned for use in either further customization of the VPG or passed to the `Save-ZertoVpgSetting` command to commit the changes.
|
||||
|
||||
## SYNTAX
|
||||
|
||||
### VpgName (Default)
|
||||
```
|
||||
Add-ZertoVpgVm -VpgName <String> -Vm <String[]> [-WhatIf] [-Confirm] [<CommonParameters>]
|
||||
```
|
||||
|
||||
### VpgSettingsIdentifier
|
||||
```
|
||||
Add-ZertoVpgVm -vpgSettingsIdentifier <String> -Vm <String[]> [-WhatIf] [-Confirm] [<CommonParameters>]
|
||||
```
|
||||
|
||||
## DESCRIPTION
|
||||
Adds one or more virtual machines to an existing VPG. A VPG Settings Identifier will be returned for use in either further customization of the VPG or passed to the `Save-ZertoVpgSetting` command to commit the changes.
|
||||
|
||||
Internal logic to the function will only process unique items and ensure that VMs meet requirements to replicate to the target site. These requirements include not currently a member of the specified VPG, not currently replicating to the target site, and not a member of 3 or more VPGs.
|
||||
|
||||
## EXAMPLES
|
||||
|
||||
### Example 1
|
||||
```powershell
|
||||
PS C:\> Add-ZertoVpgVm -VpgSettingsIdentifier $vpgSettingsIdentifier -Vm "VM 1", "Vm 2"
|
||||
```
|
||||
|
||||
Adds "VM 1" and "VM 2" to the Vpg with VpgSettingsIdentifer specified in `$VpgSettingsIdentifier`. This variable was obtained via other functions that create and return a Vpg Settings Identifier. The Vpg Settings Identifier passed into the function will be returned.
|
||||
|
||||
### Example 2
|
||||
```powershell
|
||||
PS C:\> Add-ZertoVpgVm -VpgName "My Vpg" -Vm "VM 1", "Vm 2"
|
||||
```
|
||||
|
||||
Adds "VM 1" and "VM 2" to the Vpg named "My Vpg". In this case, a new Vpg Settings Identifier will be created and returned.
|
||||
|
||||
## PARAMETERS
|
||||
|
||||
### -Vm
|
||||
Name of VM(s) to add to the VPG
|
||||
|
||||
```yaml
|
||||
Type: String[]
|
||||
Parameter Sets: (All)
|
||||
Aliases:
|
||||
|
||||
Required: True
|
||||
Position: Named
|
||||
Default value: None
|
||||
Accept pipeline input: False
|
||||
Accept wildcard characters: False
|
||||
```
|
||||
|
||||
### -VpgName
|
||||
Target VPG Name to Add the VM
|
||||
|
||||
```yaml
|
||||
Type: String
|
||||
Parameter Sets: VpgName
|
||||
Aliases:
|
||||
|
||||
Required: True
|
||||
Position: Named
|
||||
Default value: None
|
||||
Accept pipeline input: False
|
||||
Accept wildcard characters: False
|
||||
```
|
||||
|
||||
### -vpgSettingsIdentifier
|
||||
Vpg Settings Identifier
|
||||
|
||||
```yaml
|
||||
Type: String
|
||||
Parameter Sets: VpgSettingsIdentifier
|
||||
Aliases: sid, settingsIdentifier, vpgSettingsId
|
||||
|
||||
Required: True
|
||||
Position: Named
|
||||
Default value: None
|
||||
Accept pipeline input: True (ByPropertyName, ByValue)
|
||||
Accept wildcard characters: False
|
||||
```
|
||||
|
||||
### -Confirm
|
||||
Prompts you for confirmation before running the cmdlet.
|
||||
|
||||
```yaml
|
||||
Type: SwitchParameter
|
||||
Parameter Sets: (All)
|
||||
Aliases: cf
|
||||
|
||||
Required: False
|
||||
Position: Named
|
||||
Default value: None
|
||||
Accept pipeline input: False
|
||||
Accept wildcard characters: False
|
||||
```
|
||||
|
||||
### -WhatIf
|
||||
Shows what would happen if the cmdlet runs.
|
||||
The cmdlet is not run.
|
||||
|
||||
```yaml
|
||||
Type: SwitchParameter
|
||||
Parameter Sets: (All)
|
||||
Aliases: wi
|
||||
|
||||
Required: False
|
||||
Position: Named
|
||||
Default value: None
|
||||
Accept pipeline input: False
|
||||
Accept wildcard characters: False
|
||||
```
|
||||
|
||||
### CommonParameters
|
||||
This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216).
|
||||
|
||||
## INPUTS
|
||||
|
||||
### System.String
|
||||
|
||||
## OUTPUTS
|
||||
|
||||
### System.Object
|
||||
|
||||
## NOTES
|
||||
|
||||
## RELATED LINKS
|
||||
[Adding VMs to a VPG Settings Object](https://s3.amazonaws.com/zertodownload_docs/Latest/Zerto%20Virtual%20Replication%20Zerto%20Virtual%20Manager%20(ZVM)%20-%20vSphere%20Online%20Help/content/zvr_apis/vpg_management_api.htm?tocpath=ZVR%20RESTful%20APIs%7CZerto%20APIs%7C_____20#statusapis_4057192544_1358357)
|
||||
@@ -19,7 +19,7 @@ Get-ZertoEvent [<CommonParameters>]
|
||||
|
||||
### filter
|
||||
```
|
||||
Get-ZertoEvent [-startDate <String>] [-endDate <String>] [-vpgName <String>] [-vpgIdentifier <String>]
|
||||
Get-ZertoEvent [-startDate <String>] [-endDate <String>] [-vpg <String>] [-vpgIdentifier <String>]
|
||||
[-eventType <String>] [-siteName <String>] [-siteIdentifier <String>] [-zorgIdentifier <String>]
|
||||
[-entityType <String>] [-userName <String>] [-category <String>] [-eventCategory <String>]
|
||||
[-alertIdentifier <String>] [<CommonParameters>]
|
||||
@@ -309,13 +309,13 @@ Accept pipeline input: False
|
||||
Accept wildcard characters: False
|
||||
```
|
||||
|
||||
### -vpgIdentifier
|
||||
The identifier of the VPG for which you want to return events.
|
||||
### -vpg
|
||||
The name of the VPG for which you want to return events.
|
||||
|
||||
```yaml
|
||||
Type: String
|
||||
Parameter Sets: filter
|
||||
Aliases: vpgId
|
||||
Aliases: vpgName
|
||||
|
||||
Required: False
|
||||
Position: Named
|
||||
@@ -324,13 +324,13 @@ Accept pipeline input: False
|
||||
Accept wildcard characters: False
|
||||
```
|
||||
|
||||
### -vpgName
|
||||
The name of the VPG for which you want to return events.
|
||||
### -vpgIdentifier
|
||||
The identifier of the VPG for which you want to return events.
|
||||
|
||||
```yaml
|
||||
Type: String
|
||||
Parameter Sets: filter
|
||||
Aliases: vpg
|
||||
Aliases: vpgId
|
||||
|
||||
Required: False
|
||||
Position: Named
|
||||
|
||||
+13
-13
@@ -14,21 +14,20 @@ Start a move of a VPG.
|
||||
|
||||
### main (Default)
|
||||
```
|
||||
Invoke-ZertoMove [-vpgName] <String[]> [[-commitPolicy] <String>] [[-commitPolicyTimeout] <Int32>]
|
||||
[-forceShutdown] [-ContinueOnPreScriptFailure] [-WhatIf] [-Confirm] [<CommonParameters>]
|
||||
Invoke-ZertoMove -vpgName <String[]> [-commitPolicy <String>] [-commitPolicyTimeout <Int32>] [-forceShutdown]
|
||||
[-ContinueOnPreScriptFailure] [-WhatIf] [-Confirm] [<CommonParameters>]
|
||||
```
|
||||
|
||||
### disableReverseProtection
|
||||
```
|
||||
Invoke-ZertoMove [-vpgName] <String[]> [[-commitPolicy] <String>] [[-commitPolicyTimeout] <Int32>]
|
||||
[-forceShutdown] [-disableReverseProtection] [-ContinueOnPreScriptFailure] [-WhatIf] [-Confirm]
|
||||
[<CommonParameters>]
|
||||
Invoke-ZertoMove -vpgName <String[]> [-commitPolicy <String>] [-commitPolicyTimeout <Int32>] [-forceShutdown]
|
||||
[-disableReverseProtection] [-ContinueOnPreScriptFailure] [-WhatIf] [-Confirm] [<CommonParameters>]
|
||||
```
|
||||
|
||||
### keepSourceVms
|
||||
```
|
||||
Invoke-ZertoMove [-vpgName] <String[]> [[-commitPolicy] <String>] [[-commitPolicyTimeout] <Int32>]
|
||||
[-forceShutdown] [-keepSourceVms] [-ContinueOnPreScriptFailure] [-WhatIf] [-Confirm] [<CommonParameters>]
|
||||
Invoke-ZertoMove -vpgName <String[]> [-commitPolicy <String>] [-commitPolicyTimeout <Int32>] [-forceShutdown]
|
||||
[-keepSourceVms] [-ContinueOnPreScriptFailure] [-WhatIf] [-Confirm] [<CommonParameters>]
|
||||
```
|
||||
|
||||
## DESCRIPTION
|
||||
@@ -58,9 +57,10 @@ Default is the Site Settings setting.
|
||||
Type: String
|
||||
Parameter Sets: (All)
|
||||
Aliases:
|
||||
Accepted values: Rollback, Commit, None
|
||||
|
||||
Required: False
|
||||
Position: 1
|
||||
Position: Named
|
||||
Default value: None
|
||||
Accept pipeline input: False
|
||||
Accept wildcard characters: False
|
||||
@@ -76,7 +76,7 @@ Parameter Sets: (All)
|
||||
Aliases:
|
||||
|
||||
Required: False
|
||||
Position: 2
|
||||
Position: Named
|
||||
Default value: None
|
||||
Accept pipeline input: False
|
||||
Accept wildcard characters: False
|
||||
@@ -91,7 +91,7 @@ Parameter Sets: (All)
|
||||
Aliases:
|
||||
|
||||
Required: False
|
||||
Position: 6
|
||||
Position: Named
|
||||
Default value: None
|
||||
Accept pipeline input: False
|
||||
Accept wildcard characters: False
|
||||
@@ -121,7 +121,7 @@ Parameter Sets: (All)
|
||||
Aliases:
|
||||
|
||||
Required: False
|
||||
Position: 3
|
||||
Position: Named
|
||||
Default value: None
|
||||
Accept pipeline input: False
|
||||
Accept wildcard characters: False
|
||||
@@ -136,7 +136,7 @@ Parameter Sets: keepSourceVms
|
||||
Aliases:
|
||||
|
||||
Required: True
|
||||
Position: 5
|
||||
Position: Named
|
||||
Default value: None
|
||||
Accept pipeline input: False
|
||||
Accept wildcard characters: False
|
||||
@@ -151,7 +151,7 @@ Parameter Sets: (All)
|
||||
Aliases:
|
||||
|
||||
Required: True
|
||||
Position: 0
|
||||
Position: Named
|
||||
Default value: None
|
||||
Accept pipeline input: False
|
||||
Accept wildcard characters: False
|
||||
|
||||
+12
-12
@@ -12,6 +12,16 @@ Creates a New VPG with default settings only. Customization of VM settings can b
|
||||
|
||||
## SYNTAX
|
||||
|
||||
### recoveryHostDatastore (Default)
|
||||
```
|
||||
New-ZertoVpg -vpgName <String> [-vpgPriority <String>] [-journalHistoryInHours <Int32>] -protectedVm <String[]>
|
||||
-recoverySite <String> -recoveryHost <String> -datastore <String> -recoveryFolder <String>
|
||||
[-rpoInSeconds <Int32>] [-testIntervalInMinutes <Int32>] [-serviceProfile <String>]
|
||||
[-useWanCompression <Boolean>] [-zorg <String>] -recoveryNetwork <String> -testNetwork <String>
|
||||
[-journalDatastore <String>] [-journalHardLimitInMb <UInt64>] [-journalWarningThresholdInMb <UInt64>]
|
||||
[-WhatIf] [-Confirm] [<CommonParameters>]
|
||||
```
|
||||
|
||||
### recoveryClusterDatastoreCluster
|
||||
```
|
||||
New-ZertoVpg -vpgName <String> [-vpgPriority <String>] [-journalHistoryInHours <Int32>] -protectedVm <String[]>
|
||||
@@ -42,16 +52,6 @@ New-ZertoVpg -vpgName <String> [-vpgPriority <String>] [-journalHistoryInHours <
|
||||
[-WhatIf] [-Confirm] [<CommonParameters>]
|
||||
```
|
||||
|
||||
### recoveryHostDatastore
|
||||
```
|
||||
New-ZertoVpg -vpgName <String> [-vpgPriority <String>] [-journalHistoryInHours <Int32>] -protectedVm <String[]>
|
||||
-recoverySite <String> -recoveryHost <String> -datastore <String> -recoveryFolder <String>
|
||||
[-rpoInSeconds <Int32>] [-testIntervalInMinutes <Int32>] [-serviceProfile <String>]
|
||||
[-useWanCompression <Boolean>] [-zorg <String>] -recoveryNetwork <String> -testNetwork <String>
|
||||
[-journalDatastore <String>] [-journalHardLimitInMb <UInt64>] [-journalWarningThresholdInMb <UInt64>]
|
||||
[-WhatIf] [-Confirm] [<CommonParameters>]
|
||||
```
|
||||
|
||||
### recoveryResourcePoolDatastoreCluster
|
||||
```
|
||||
New-ZertoVpg -vpgName <String> [-vpgPriority <String>] [-journalHistoryInHours <Int32>] -protectedVm <String[]>
|
||||
@@ -176,7 +176,7 @@ Name of the datastore where the VM(s), Volume(s), and Journal(s) will reside.
|
||||
|
||||
```yaml
|
||||
Type: String
|
||||
Parameter Sets: recoveryClusterDatastore, recoveryHostDatastore, recoveryResourcePoolDatastore
|
||||
Parameter Sets: recoveryHostDatastore, recoveryClusterDatastore, recoveryResourcePoolDatastore
|
||||
Aliases:
|
||||
|
||||
Required: True
|
||||
@@ -312,7 +312,7 @@ Name of the host where the VM(s) will be recovered.
|
||||
|
||||
```yaml
|
||||
Type: String
|
||||
Parameter Sets: recoveryHostDatastoreCluster, recoveryHostDatastore
|
||||
Parameter Sets: recoveryHostDatastore, recoveryHostDatastoreCluster
|
||||
Aliases:
|
||||
|
||||
Required: True
|
||||
|
||||
@@ -21,7 +21,7 @@ Remove-ZertoVpg -vpgidentifier <String[]> [-keepRecoveryVolumes] [-force] [-What
|
||||
|
||||
### vpgName
|
||||
```
|
||||
Remove-ZertoVpg [-vpgName] <String[]> [-keepRecoveryVolumes] [-force] [-WhatIf] [-Confirm] [<CommonParameters>]
|
||||
Remove-ZertoVpg -vpgName <String[]> [-keepRecoveryVolumes] [-force] [-WhatIf] [-Confirm] [<CommonParameters>]
|
||||
```
|
||||
|
||||
## DESCRIPTION
|
||||
@@ -122,7 +122,7 @@ Parameter Sets: vpgName
|
||||
Aliases:
|
||||
|
||||
Required: True
|
||||
Position: 0
|
||||
Position: Named
|
||||
Default value: None
|
||||
Accept pipeline input: True (ByPropertyName, ByValue)
|
||||
Accept wildcard characters: False
|
||||
|
||||
@@ -0,0 +1,121 @@
|
||||
---
|
||||
external help file: ZertoApiWrapper-help.xml
|
||||
Module Name: ZertoApiWrapper
|
||||
online version: https://github.com/ZertoPublic/ZertoApiWrapper/blob/master/docs/Resume-ZertoVpgVm.md
|
||||
schema: 2.0.0
|
||||
---
|
||||
|
||||
# Remove-ZertoVpgVm
|
||||
|
||||
## SYNOPSIS
|
||||
Removes one or more VMs from a specified VPG. A Task Identifier is returned to track progress.
|
||||
|
||||
## SYNTAX
|
||||
|
||||
```
|
||||
Remove-ZertoVpgVm -VpgName <String> -Vm <String[]> [-WhatIf] [-Confirm] [<CommonParameters>]
|
||||
```
|
||||
|
||||
## DESCRIPTION
|
||||
Removes one or more VMs from a specified VPG. A Task Identifier is returned to track progress. Internal logic will remove duplicate VM names from the list of VMs provided as well as ensure membership in the VPG specified prior to attempting to remove the VM from the VPG. Finally the VPG is saved to commit the changes. ChangeImpact is set to 'High' to get the confirmation prompt.
|
||||
|
||||
## EXAMPLES
|
||||
|
||||
### Example 1
|
||||
```powershell
|
||||
PS C:\> Remove-ZertoVpgVm -VpgName 'My Vpg' -Vm 'Vm 1'
|
||||
```
|
||||
|
||||
Removes 'Vm 1' from Vpg named 'My Vpg'
|
||||
|
||||
### Example 2
|
||||
```powershell
|
||||
PS C:\> Remove-ZertoVpgVm -VpgName 'My Vpg' -Vm 'Vm 1', 'Vm 2'
|
||||
```
|
||||
|
||||
Removes 'Vm 1' and 'Vm 2' from Vpg named 'My Vpg'.
|
||||
|
||||
### Example 3
|
||||
```powershell
|
||||
PS C:\> Remove-ZertoVpgVm -VpgName 'My Vpg' -Vm 'Vm 1', 'Vm 2' -Confirm:$False
|
||||
```
|
||||
|
||||
Removes 'Vm 1' and 'Vm 2' from Vpg named 'My Vpg' and bypasses the confirmation prompt
|
||||
|
||||
## PARAMETERS
|
||||
|
||||
### -Vm
|
||||
Name of VM(s) to remove from the VPG
|
||||
|
||||
```yaml
|
||||
Type: String[]
|
||||
Parameter Sets: (All)
|
||||
Aliases:
|
||||
|
||||
Required: True
|
||||
Position: Named
|
||||
Default value: None
|
||||
Accept pipeline input: False
|
||||
Accept wildcard characters: False
|
||||
```
|
||||
|
||||
### -VpgName
|
||||
Name of the VPG that contains the VM you wish to remove
|
||||
|
||||
```yaml
|
||||
Type: String
|
||||
Parameter Sets: (All)
|
||||
Aliases:
|
||||
|
||||
Required: True
|
||||
Position: Named
|
||||
Default value: None
|
||||
Accept pipeline input: False
|
||||
Accept wildcard characters: False
|
||||
```
|
||||
|
||||
### -Confirm
|
||||
Prompts you for confirmation before running the cmdlet.
|
||||
|
||||
```yaml
|
||||
Type: SwitchParameter
|
||||
Parameter Sets: (All)
|
||||
Aliases: cf
|
||||
|
||||
Required: False
|
||||
Position: Named
|
||||
Default value: None
|
||||
Accept pipeline input: False
|
||||
Accept wildcard characters: False
|
||||
```
|
||||
|
||||
### -WhatIf
|
||||
Shows what would happen if the cmdlet runs.
|
||||
The cmdlet is not run.
|
||||
|
||||
```yaml
|
||||
Type: SwitchParameter
|
||||
Parameter Sets: (All)
|
||||
Aliases: wi
|
||||
|
||||
Required: False
|
||||
Position: Named
|
||||
Default value: None
|
||||
Accept pipeline input: False
|
||||
Accept wildcard characters: False
|
||||
```
|
||||
|
||||
### CommonParameters
|
||||
This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216).
|
||||
|
||||
## INPUTS
|
||||
|
||||
### None
|
||||
|
||||
## OUTPUTS
|
||||
|
||||
### System.Object
|
||||
## NOTES
|
||||
|
||||
## RELATED LINKS
|
||||
[Remove Vms from a VPG Settings Object](https://s3.amazonaws.com/zertodownload_docs/Latest/Zerto%20Virtual%20Replication%20Zerto%20Virtual%20Manager%20(ZVM)%20-%20vSphere%20Online%20Help/content/zvr_apis/vpg_management_api.htm?tocpath=ZVR%20RESTful%20APIs%7CZerto%20APIs%7C_____20#statusapis_4057192544_1361409)
|
||||
@@ -36,10 +36,10 @@ VpgSettings Identifier to save
|
||||
```yaml
|
||||
Type: String
|
||||
Parameter Sets: (All)
|
||||
Aliases: vpgSettingsId
|
||||
Aliases: sid, settingsIdentifier, vpgSettingsId
|
||||
|
||||
Required: True
|
||||
Position: 1
|
||||
Position: 0
|
||||
Default value: None
|
||||
Accept pipeline input: True (ByPropertyName, ByValue)
|
||||
Accept wildcard characters: False
|
||||
|
||||
Reference in New Issue
Block a user