Files
ZertoApiWrapper/ZertoApiWrapper/Public/Invoke-ZertoMoveRollback.ps1
T
2019-04-16 16:18:33 -04:00

35 lines
952 B
PowerShell

<# .ExternalHelp ./en-us/ZertoApiWrapper-help.xml #>
function Invoke-ZertoMoveRollback {
[cmdletbinding(SupportsShouldProcess = $true)]
param(
[Parameter(
HelpMessage = "Name(s) of VPG(s) to roll back from failing over",
Mandatory = $true
)]
[ValidateNotNullOrEmpty()]
[string[]]$vpgName
)
begin {
$baseUri = "vpgs"
}
process {
foreach ($name in $vpgName) {
$id = $(Get-ZertoVpg -name $name).vpgIdentifier
if ( -not $id ) {
Write-Error "VPG: $name not found. Please check the name and try again."
} else {
$uri = "{0}/{1}/moveRollBack" -f $baseUri, $id
if ($PSCmdlet.ShouldProcess("Rolling back VPG: $name")) {
Invoke-ZertoRestRequest -uri $uri -method "POST"
}
}
}
}
end {
#Nothing to do
}
}