This update has all the code needed to connect to a zvma 10.0 (and probabaly 9.7) and allow the end user to connect to zvma as well as run all of the other functions.
@@ -5,6 +5,103 @@ 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).
## [2.1.0]
### Added
* Added Support for Zerto 10.7u1 Virtual Appliance - You can now authenticate to Zerto Virtual Appliances and run the other functions of this module.
### Updated
* Updated `Invoke-ZertoRestRequest` function [help documentation](https://github.com/ZertoPublic/ZertoApiWrapper/blob/master/docs/Install-ZertoVra.md)
## [2.0.0]
### Added
* Added Support for Zerto 10 Virtual Appliance - You can now authenticate to Zerto Virtual Appliances and run the other functions of this module.
### Updated
* Updated `Connect-ZertoServer` function [help documentation](https://github.com/ZertoPublic/ZertoApiWrapper/blob/master/docs/Install-ZertoVra.md)
* Updated `Invoke-ZertoRestRequest` function [help documentation](https://github.com/ZertoPublic/ZertoApiWrapper/blob/master/docs/Install-ZertoVra.md)
## [1.5.4]
### Zerto Virtual Manager
#### Updated
* Updated `Install-ZertoVra` function [help documentation](https://github.com/ZertoPublic/ZertoApiWrapper/blob/master/docs/Install-ZertoVra.md) to allow for configuring the number of vCPUs during deployment. Special thanks to @mitchellen for the fix.
## [1.5.3]
### Zerto Virtual Manager
#### Fixed
* Fixed an [issue](https://github.com/ZertoPublic/ZertoApiWrapper/issues/112) where `New-ZertoVpg` would fail when specifying the local site as the target site.
* Updated the method where a Site Identifer is obtained during the `New-ZertoVpg` execution that would occasionally fail on some versions of PowerShell.
#### Updated
* Updated `New-ZertoVpg` function [help documentation](https://github.com/ZertoPublic/ZertoApiWrapper/blob/master/docs/New-ZertoVpg.md) to more clearly specify the return value and the requirement to pass it into the `Save-ZertoVpgSetting` function to commit the VPG.
## [1.5.2]
### Zerto Virtual Manager
#### Fixed
* Fixed an issue when attempting to export more than 100 VPGs with the `Export-ZertoVpg` function that would cause an error.
## [1.5.1]
### Zerto Virtual Manager
#### Fixed
* Fixed an [issue](https://github.com/ZertoPublic/ZertoApiWrapper/issues/108) with `New-ZertoVpg` where when specifying a single host as a recovery target, the host identifier was not properly assigned. - Thanks @jonsouzerto!
* Fixed an [issue](https://github.com/ZertoPublic/ZertoApiWrapper/issues/86) with `Invoke-ZertoMoveVpg` where parameters should have been mandatory in certain workflows. - Thanks @gdbarron!
## [1.5.0]
### 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.
#### Fixed
* Fixed an [issue](https://github.com/ZertoPublic/ZertoApiWrapper/issues/103) with `Add-ZertoPeerSite` where there was an incorrect settings validator on the `-targetHost` parameter where it would not accept a hostname.
## [1.4.3]
### Zerto Virtual Manager
#### Updated
* Updated `Connect-ZertoServer` with a `-AutoReconnect` switch to allow the auto reconnection of a session that has timed-out.
* Updated `New-ZertoVpg` to have a Default Parameter Set of `recoveryHostDatastore` should no parameters be passed when calling the function.
* Updated `New-ZertoVpg -recoverySite` parameter to be case-insensitive
#### Fixed
* Fixed an [issue](https://github.com/ZertoPublic/ZertoApiWrapper/issues/96) with `Set-ZertoLicense` so that ShouldProcess functions properly.
* Fixed an [issue](https://github.com/ZertoPublic/ZertoApiWrapper/issues/95) when attempting to connect to an unlicensed site.
## [1.4.2]
### Zerto Virtual Manager
#### Fixed
* Updated `Get-ZertoEvent` to translate a vpg name parameter to a vpgIdentifier per the API documentation
* Updated `Invoke-ZertoMoveCommit` to ensure that when one of the parameter switches is defined, all required parameters are sent to avoid conflicts with parameters passed with the `Invoke-ZertoMove` command.
* Updated `Start-ZertoCloneVpg` to fix an issue where an error would be thrown if an operation specified a subset of VMs to be cloned.
* [Getting Started with Zerto Virtual Manager and the ZertoApiWrapper](https://github.com/ZertoPublic/ZertoApiWrapper/wiki/Getting-Stated-with-Zerto-Virtual-Manager)
* [Getting Started with Zerto Virtual Manager and the ZertoApiWrapper](https://github.com/ZertoPublic/ZertoApiWrapper/wiki/Getting-Started-with-Zerto-Virtual-Manager)
* [Getting Started with Zerto Analytics and the ZertoApiWrapper](https://github.com/ZertoPublic/ZertoApiWrapper/wiki/Getting-Started-with-Zerto-Analytics)
HelpMessage="Target Hostname or IP address to pair the localsite to."
)]
[ValidateScript({$_-match[IPAddress]$_})]
[ValidateNotNullOrEmpty()]
[string]$targetHost,
[Parameter(
HelpMessage="Target communication port. Default is 9081"
HelpMessage="Target communication port. Default is 9071 for Zerto 10.0 and Later. For ZVR 9.7 and earlier, use port 9081."
)]
[ValidateRange(1024,65535)]
[int]$targetPort=9081,
[int]$targetPort=9071,
[Parameter(
HelpMessage="The generated token from the destination site. Note: This is only supported when both sites support pairing authentication. This was implemented to support ZVR 7.5 and later."
HelpMessage="The generated token from the destination site. Note: This is only supported when both sites support pairing authentication. This was implemented to support ZVR 10.0 and later."
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-eq3){
Write-Warning"$machine is already a part of 3 VPGs and cannot be part of an additional VPG. Skipping $machine"
continue
}elseif($results.count-eq0){
Write-Warning"$machine not found. Skipping $machine"
continue
}else{
$vmIdentifier=$results|Select-Object-First1
}
}
# 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-gt0-and$PSCmdlet.ShouldProcess($VmIdentifiers,"Adding VM(s): $Vm to Vpg $VpgName")){
foreach($idin$VmIdentifiers){
# Build the Body
$Body=@{VmIdentifier=$id}
# Submit the request. Out to Null to prevent line returns while running.
HelpMessage="Zerto Virtual Manager management port. Default value is 443."
)]
[ValidateNotNullOrEmpty()]
[ValidateRange(443,65535)]
[Alias("port")]
[string]$zertoPort="443",
[Parameter(
HelpMessage="Zerto Keycloak client id. Default value is zerto-client."
)]
[ValidateNotNullOrEmpty()]
[Alias("clientid")]
[string]$zertoClientId="zerto-client",
[Parameter(
HelpMessage="Use this switch to indicate that you would like the module to take care of auto re-authorization and reconnection to the ZVM should the token expire. This option will cache your PSCredential object to be reused"
)]
[switch]$AutoReconnect,
[Parameter(
HelpMessage="Use this switch to return the Bearer Token to a specified variable or to the default output."
HelpMessage="Name(s) of the VPG(s) you want to move.",
Mandatory
)]
[Parameter(
ParameterSetName='commitName',
HelpMessage="Name(s) of the VPG(s) you want to move.",
Mandatory
)]
[ValidateNotNullOrEmpty()]
[string[]]$vpgName,
[Parameter(
ParameterSetName='id',
HelpMessage="ID(s) of the VPG(s) you want to move.",
Mandatory,
ValueFromPipelineByPropertyName
)]
[Parameter(
ParameterSetName='commitId',
HelpMessage="ID(s) of the VPG(s) you want to move.",
Mandatory,
ValueFromPipelineByPropertyName
)]
[ValidateNotNullOrEmpty()]
[guid[]]$vpgIdentifier,
[Parameter(
ParameterSetName='commitName',
HelpMessage="'Rollback': After the seconds specified in the commitValue setting have elapsed, the failover is rolled back.
'Commit': After the seconds specified in the commitValue setting have elapsed, the failover continues, committing the virtual machines in the recovery site.
'None': The virtual machines in the VPG being failed over remain in the Before Commit state until either they are committed with Commit a failover, or rolled back with Roll back a failover.
Default is the Site Settings setting."
Default is the Site Settings setting.",
Mandatory
)]
[Parameter(
ParameterSetName='commitId',
HelpMessage="'Rollback': After the seconds specified in the commitValue setting have elapsed, the failover is rolled back.
'Commit': After the seconds specified in the commitValue setting have elapsed, the failover continues, committing the virtual machines in the recovery site.
'None': The virtual machines in the VPG being failed over remain in the Before Commit state until either they are committed with Commit a failover, or rolled back with Roll back a failover.
Default is the Site Settings setting.",
Mandatory
)]
[ValidateSet("Rollback","Commit","None")]
[string]$commitPolicy,
[Parameter(
ParameterSetName='commitName',
HelpMessage="The amount of time, in seconds, the Move is in a 'Before Commit' state, before performing the commitPolicy setting. If omitted, the site settings default will be applied."
)]
[Parameter(
ParameterSetName='commitId',
HelpMessage="The amount of time, in seconds, the Move is in a 'Before Commit' state, before performing the commitPolicy setting. If omitted, the site settings default will be applied."
)]
# Min 5 Minutes, Max 24 Hours, Default Site Settigns.
@@ -27,15 +62,11 @@ function Invoke-ZertoMove {
)]
[switch]$forceShutdown,
[Parameter(
ParameterSetName="disableReverseProtection",
HelpMessage="Do not enable reverse protection. The VPG definition is kept with the status Needs Configuration and the reverse settings in the VPG definition are not set.",
Mandatory
HelpMessage="Do not enable reverse protection. The VPG definition is kept with the status Needs Configuration and the reverse settings in the VPG definition are not set."
)]
[switch]$disableReverseProtection,
[Parameter(
ParameterSetName="keepSourceVms",
HelpMessage="Prevent the protected virtual machines from being deleted in the protected site. Using this setting disables reverse protection.",
Mandatory
HelpMessage="Prevent the protected virtual machines from being deleted in the protected site. Using this setting disables reverse protection."
@@ -9,11 +9,16 @@ function Invoke-ZertoMoveCommit {
[ValidateNotNullOrEmpty()]
[string[]]$vpgName,
[Parameter(
HelpMessage="Set this to True to reverse protect the VPG(s) to the source site. If not set, will use selection made during move initiation. True or False"
HelpMessage="Use this switch to reverse protect the VPG(s) to the source site. If neither 'ReverseProtction' nor 'KeepSourceVms' switch is specified, the commit process will use selection made during move initiation.",
ParameterSetName='ReverseProtect',
Mandatory
)]
[switch]$reverseProtection,
[Parameter(
HelpMessage="Use this switch to keep the source VMs. If not set, they will be destroyed."
HelpMessage="Use this switch to keep the source VMs at the source site. If neither 'ReverseProtction' nor 'KeepSourceVms' switch is specified, the commit process will use selection made during move initiation.",
ParameterSetName='KeepSource',
Mandatory
)]
[switch]$keepSourceVms
)
@@ -21,10 +26,16 @@ function Invoke-ZertoMoveCommit {
Pairs the current Zerto Virtual Manager to the Zerto Virtual Manager at IP address 192.168.2.100. Use this method when pairing Zerto Virtual Managers that are version 7.5 or later.
Pairs the current Zerto Virtual Manager to the Zerto Virtual Manager at IP address 192.168.2.100 over Port 9071. Use this method when pairing Zerto Virtual Managers that are version 7.5 or later.
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.
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.
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.
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)
Establishes a connection to ZVM 192.168.1.100 on port 9669 with supplied PSCredential object.
## PARAMETERS
### -credential
Valid credentials to connect to the Zerto Management Server
```yaml
Type:PSCredential
Parameter Sets:(All)
Aliases:
Required:True
Position:2
Default value:None
Accept pipeline input:False
Accept wildcard characters:False
```
### -returnHeaders
Use this switch to return the headers to a specified variable or to the default output.
```yaml
Type:SwitchParameter
Parameter Sets:(All)
Aliases:
Required:False
Position:Named
Default value:None
Accept pipeline input:False
Accept wildcard characters:False
```
### -zertoPort
Zerto Virtual Manager management port.
Default value is 9669.
```yaml
Type:String
Parameter Sets:(All)
Aliases:port
Required:False
Position:1
Default value:"9669"
Accept pipeline input:False
Accept wildcard characters:False
```
### -zertoServer
IP address or FQDN of your Zerto Management Server
```yaml
Type:String
Parameter Sets:(All)
Aliases:server, zvm
Required:True
Position:0
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
[Zerto REST API Session End Point Documentation](http://s3.amazonaws.com/zertodownload_docs/Latest/Zerto%20Virtual%20Replication%20Zerto%20Virtual%20Manager%20%28ZVM%29%20-%20vSphere%20Online%20Help/index.html#page/RestfulAPIs%2FStatusAPIs.5.068.html%23)
Establishes a connection to ZVM 192.168.1.100 on port 443 with supplied PSCredential object. Adding the `-AutoReconnect` switch
will cache the PSCredential object should the session need to be reauthorized due to an expired token.
## PARAMETERS
### -AutoReconnect
Use this switch to indicate that you would like the module to take care of auto re-authorization and reconnection to the ZVM should the token expire. This option will cache your PSCredential object to be reused
```yaml
Type:SwitchParameter
Parameter Sets:(All)
Aliases:
Required:False
Position:Named
Default value:None
Accept pipeline input:False
Accept wildcard characters:False
```
### -credential
Valid credentials to connect to the Zerto Management Server
```yaml
Type:PSCredential
Parameter Sets:(All)
Aliases:
Required:True
Position:1
Default value:None
Accept pipeline input:False
Accept wildcard characters:False
```
### -returnHeaders
Use this switch to return the headers to a specified variable or to the default output.
```yaml
Type:SwitchParameter
Parameter Sets:(All)
Aliases:
Required:False
Position:Named
Default value:None
Accept pipeline input:False
Accept wildcard characters:False
```
### -zertoPort
Zerto Virtual Manager management port.
Default value is 443.
```yaml
Type:String
Parameter Sets:(All)
Aliases:port
Required:False
Position:Named
Default value:"443"
Accept pipeline input:False
Accept wildcard characters:False
```
### -zertoServer
IP address or FQDN of your Zerto Management Server
```yaml
Type:String
Parameter Sets:(All)
Aliases:server, zvm
Required:True
Position:0
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
[Zerto REST API Session End Point Documentation](http://s3.amazonaws.com/zertodownload_docs/Latest/Zerto%20Virtual%20Replication%20Zerto%20Virtual%20Manager%20%28ZVM%29%20-%20vSphere%20Online%20Help/index.html#page/RestfulAPIs%2FStatusAPIs.5.068.html%23)
@@ -27,20 +37,33 @@ Commit a VPG currently undergoing a move operation.
PS C:\>Invoke-ZertoMoveCommit-vpgName"MyVpg"
```
Commit VPG "MyVpg" after a move has been started.
Commit VPG "MyVpg" after a move operation has been completed. This commit process with use the `-KeepSourceVms` or `-ReverseProtection` selection made during the move initation.
Commit VPG "MyVpg" after a move operation has been completed specifying to keep the vms at the source location and NOT reverse protection. This commit process will overrule any reverse protection or keep source vms selection made during the move initiation.
Commit VPG "MyVpg" after a move operation has been completed specifying to reverse protection of the VMs back to the source location. The VMs at the source location will be removed from inventory at the source location and the disks will be used as pre-seed volumes. This commit process will overrule any reverse protection or keep source vms selection made during the move initiation.
## PARAMETERS
### -keepSourceVms
Use this switch to keep the source VMs.
If not set, they will be destroyed.
"Use this switch to keep the source VMs at the source site. If neither 'ReverseProtction' nor 'KeepSourceVms' switch is specified, the commit process will use selection made during move initiation."
Set this to True to reverse protect the VPG(s) to the source site. If not set, will use selection made during move initiation. True or False
"Use this switch to reverse protect the VPG(s) to the source site. If neither 'ReverseProtction' nor 'KeepSourceVms' switch is specified, the commit process will use selection made during move initiation."
Creates a New VPG with default settings only. Customization of VM settings can be accomplished with other module level functions.
Creates a New VPG with default settings only. Customization of VM settings can be accomplished with other module level functions. Returns a VpgSettingsIdentifier to be passed into the `Save-ZertoVpgSetting` function to create the VPG.
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.
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)
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.