How to pause/resume protected,replicated and clustered agents in one step using PowerShell
说明
You have a rather complex environment which includes multiple source and target cores, clusters etc. Under the circumstances, pausing and resuming snapshots and replication for maintenance purposes, even while using the Powershell commandlets provided by the AppAssurePowerShellModule is a daunting task, especially if you are scripting some in depth periodic maintenance for the core server in question. You want an easy way to pause and resume protection and replication either for all or a few of the machines and clusters serviced by the core that could be run in conjunction with other scripted maintenance operations.
解决办法
A PowerShell script to address the issue has been prepared. The script identifies protected servers, replicated servers and clusters. When run with the appropriate parameter, allows pausing/resuming protection and replication for protected servers and clusters and pausing/resuming replication for replicated servers and clusters. If necessary, the operation can be performed only on the desired agents, by using the interactive parameter. The current status of protection/replication may be determined using the -status parameter. Please note that the status information refers to the local core only. Powershell 3.0 or later is needed. The script works on AppAssure 5.4.x deployments. The script is fully documented. The documentation may be generated by running:
PS c:\Scripts> Get-Help .\pauseresume.3.ps1 -full
The script is included below between horizontal lines and attached to this KB.
<# .Synopsis Pauses and resumes both protection and replication
.Description This script gets a list of agent which maybe protected, replicated, clusters etc and pauses protection and/or replication for each. For instance a protected server which is replicated to a remote core is both paused and its replication is paused as well. The replication of an agent from a remote core is paused as well. The script compensates for some errors in the AppAssure powershell commandlets that do not allow, for instance, pausing clusters. The information regarding the status of agents is shown at core level only. Once the script is run,
.Parameter pause pauses prtection & replication for each qualified agent
.Parameter resume resumes prtection & replication for each qualified agent
.Parameter interactive allows selecting the agents to process
.Parameter status list agents and shows their status