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.

µ

5 Comments

  1. IllRep

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

    Reply
  2. VT-Tech

    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!

    Reply
  3. Andy

    Hi Mike, I used this procedure and it worked. However, I found scheduled task despite being set to run as the account with highest privs, it required the account to be logged in for the scheduled task to run. When logged out, it would run. I figured you might have an idea as to why. I have a 2012 Server (not R2) for the AppAssure core server. Thanks. – Andy

    Reply
  4. Andy

    Hi Mike,

    I used this procedure and it worked. However, I found the scheduled tasks despite being set to run as the account with highest privs, required the account to be logged in for the scheduled task to run. When the account was logged out, it wouldn’t run.

    I figured you might have an idea as to why. I have a 2012 Server (not R2) for the AppAssure core server. Thanks. – Andy

    Reply

Leave a Reply

%d bloggers like this: