Use PowerShell to Create a Scheduled Task that Uses PowerShell to Pause and Resume AppAssure Core Replication

In this scenario there are multiple AppAssure Core servers, one at each physical location that is used to backup the local servers. Each AppAssure Core server is setup to replicate its data to an offsite AppAssure Core server at a separate physical location across a wide area network for disaster recovery purposes. Due to bandwidth constraints, you want to pause the replication between the AppAssure Core servers during normal business hours.

All of the AppAssure Core servers in this scenario are running Windows Server 2008 R2, they all have PowerShell version 3 installed, PowerShell remoting enabled, and AppAssure 5.3.1 or higher installed.

First, we’ll create a PSSession to the remote AppAssure Core server that we want to create the scheduled tasks on so we don’t have the overhead of setting up and tearing down multiple remote PowerShell sessions to the same server:

I’ve specified the -Credential parameter and used the Get-Credential cmdlet so this script will prompt me for credentials since I’m running PowerShell as a user that doesn’t have access to the remote AppAssure Core server. These are the credentials that our scripts will run as in this scenario:

appassure123-1

This script will create a scheduled task that will run at 7:30am seven days a week. The scheduled task runs a PowerShell command which pauses the AppAssure replication from the server it is run on to the one that is specified via the -Outgoing parameter of the Suspend-Replication cmdlet. The credentials it is prompting us for are the credentials the scheduled task will run as (they will be saved as part of the scheduled task):

appassure123-2

appassure123-3

Similar to the above script, the following PowerShell script creates a scheduled task on the AppAssure Core server that we created the PSSession to in the first command. The scheduled task runs at 6:30pm seven days a week. This scheduled task runs a PowerShell cmdlet (Resume-Replication) which resumes the AppAssure replication to the server that is specified in the -Outgoing parameter.

appassure123-4

appassure123-5

When you’re finished, don’t forget about removing the PSSession. The following command will remove all PSSessions:

appassure123-6

You can see the scheduled tasks on the AppAssure Core server that the scripts shown in the previous examples were run against:

appassure123-7

By having the scheduled task execute the PowerShell cmdlet directly, the dependency of an external script that could get accidentally moved or modified is eliminated.

µ

About Mike Robbins

PowerShell Enthusiast | IT Pro | Winner of the Advanced Category in the 2013 PowerShell Scripting Games | Author of Chapter 6 in the PowerShell Deep Dives Book.
This entry was posted in AppAssure, PowerShell and tagged , . Bookmark the permalink.

3 Responses to Use PowerShell to Create a Scheduled Task that Uses PowerShell to Pause and Resume AppAssure Core Replication

  1. Pingback: Weekend Scripter: Managing Dell AppAssure with Windows PowerShell - Hey, Scripting Guy! Blog - Site Home - TechNet Blogs

  2. IllRep says:

    Great stuff thanks, Shame they have not actually put this feature back in yet as it was in V4

  3. VT-Tech says:

    Wanted to take a moment to thank you for this, use appassure 5 heavily and your insights on powershell are extremely useful. Keep up the excellent work Mike!

Leave a Reply