Files
ZertoApiWrapper/ZertoApiWrapper/Public/Invoke-ZertoForceSync.ps1
T
2020-05-05 21:59:14 -04:00

33 lines
805 B
PowerShell

<# .ExternalHelp ./en-us/ZertoApiWrapper-help.xml #>
function Invoke-ZertoForceSync {
[cmdletbinding()]
param(
[Parameter(
HelpMessage = "Name(s) of VPG(s) to force sync",
Mandatory
)]
[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. Skipping"
} else {
$uri = "{0}/{1}/forcesync" -f $baseUri, $id
Invoke-ZertoRestRequest -uri $uri -method "POST"
}
}
}
end {
#Nothing to do
}
}