Windows Task Scheduler allows you to schedule PowerShell scripts to accomplish a wide variety of AppAssure commands on the schedule that best fits your needs.
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.
Complete the steps below to have AppAssure scripts run on a schedule:
1. Open Task Scheduler
Open Task Scheduler and Create a new task. Name it and set your security options. Check "Run with highest privileges" as our scripts need to run as admin. If you want this script to run without your account signed into the AppAssure Core, enable the 'Run whether user is logged on or not' radio button.
2. Set Triggers
Click on the Triggers tab and set your schedule or event that will trigger the running of your PowerShell script.
3. Create your Action
Click on the Actions tab and click on New.
Action: Start a program
You don't need to put a path as it should already be on your system.
4. Set Argument
First you need to set the ExecutionPolicy. You have two options here, you can set the ExecutionPolicy on the machine or you can do it on a per-script basis. Read the PowerShell ExecutionPolicy link below as it talks about or you can issue the command:
To set the execution policy globally, you can issue this command from within PowerShell:
Or use one of the other settings available depending on your environment. In the context of this how-to, however, we want to set the execution policy on a per script basis and open up security for us to run the script. This security policy will only be in effect for the script we are running and not compromise security otherwise.
That means we use the following Argument:
-ExecutionPolicy Bypass -File c:\temp\agent_repl.ps1
5. Save and Test