Automating the Office365 sync365.ps1 script

  • 7019286
  • 21-Nov-2014
  • 07-Aug-2017

Environment


Retain 3.x
Exchange Module

Situation


How to best automate running the sync365.ps1 powershell script.

Resolution


Once you have created the sync365.ps1 script you will want to save a backup of those .csv files in case you have a problem later.

These instructions are based on a Windows 2008 R2 server, but the same concepts apply to Windows 2012.

Create a New Task

On the General tab, give it a name; and, for the description, you may want it read something like "Retain address book synchronization script for Office365".

Under "Security options" section, choose: “Run whether user is logged in or not”.

Under the Triggers tab, click on "New..."

Under "Settings", set it to "Daily" and set the "Start" time : [set it to run an hour before the archive job is set to begin, but it doesn’t take that long, Exchange does maintenance between 1-5 AM]

Do not expire

Check Enabled

 Under the Actions tab: Create a New action.

  • Set the Action to “Start a program
  • Program/script: powershell
  • Add arguments: -NoProfile -ExecutionPolicy Bypass -file "[drive]:\Program Files\Beginfinite\Retain\RetainServer\WEB_INF\cfg\sync365.ps1" -Verb RunAs
  • Start In: (left blank)

If you create it at the Task Scheduler (Local) level you will be able to find it in the Task Scheduler Library folder after it is created, in the center pane.

Additional Information

This article was originally published in the GWAVA knowledgebase as article ID 2409.