When performing general maintenance on your Core, it is recommended you pause replication; however, this can often be difficult if you have multiple Target and Source Cores.
To resolve this issue, you can use PowerShell to pause replication on your Cores.
PowerShell Scripting Disclaimer:
This script is provided "as is" for the purpose of illustrating how product tasks may be performed in conjunction with PowerShell. Support shall not be liable for any direct, indirect, incidental, consequential, or other damage alleged in connection with the furnishing or use of this script or of the principles it demonstrates. See PowerShell Scripting Support for more information.
Save the PowerShell script below to a .ps1 file. Ensure that the execution policy for your environment will allow scripts to run. You may set the execution policy level by running the set-executionpolicy cmdlet with the appropriate option selected (i.e. set-executionpolicy remotesigned).
#import AppAssure PowerShell Module
$import-module appassurepowershellmodule
#Set the type of operation to execute (Suspend or Resume replication)
$optype = read-host “Enter [S]uspend or [R]esume replication, any other key to exit”
$values = “S”, “s”, “R”, “r”
#if the choice is valid, go ahead
if ($values -contains $optype)
{
#set a counter to present results more clearly
$i = 1
#Get the UUIDs of the Replication Cores
$replpath = “HKEY_LOCAL_MACHINE\software\apprecovery\core\Replication\RemoteCores”
$masters = Get-childitem -path (“Microsoft.PowerShell.Core\Registry::” + $replpath +”\Masters”)
$targets = Get-childitem -path (“Microsoft.PowerShell.Core\Registry::” + $replpath +”\Slaves”)
#Report how many Source and/or Target Cores have been found
write-host “Found $(if ($masters){($masters | measure-object name).count} else {0}) Master Cores in Replication”
write-host “Found $(if($targets){($targets | measure-object name).count} else {0}) Target Cores in Replication”
#Enumerate the Targets, Stop Replication for each of them and report the result
if ($targets)
{
foreach ($target in $targets)
{
$t_core = get-itemproperty -path (“Microsoft.PowerShell.Core\Registry::” + $target.name)
Write-host “$($i). Changing replication status on Target Core $($t_core.HostName)”; $i++
if ($optype -eq “S” -or $optype -eq “s”) {suspend-replication -outgoing $t_core.HostName}
else {resume-replication -outgoing $t_core.HostName}
}
}
#Enumerate the Sources, Stop Replication for each of them and report the result
if($masters)
{
foreach ($master in $masters)
{
$m_core = get-itemproperty -path (“Microsoft.PowerShell.Core\Registry::” + $master.name)
Write-host “$($i). Changing replication status on Source Core $($m_core.HostName)”; i++
if ($optype -eq “S” -or $optype -eq “s”) {suspend-replication -incoming $m_core.HostName}
else {resume-replication -incoming $m_core.HostName}
}
}
}
else {Write-host “Exiting”}