Using a Linux-based Retain server with Office365

  • 7019287
  • 01-Apr-2015
  • 02-Jan-2018


Retain 3.x
Exchange Module


How to get the results of the sync365.ps1 to a Linux-based Retain server so the archive job can run with the latest user and group list?


While there isn't a way to run Powershell scripts on a Linux server, you can run the sync365.ps1 script on any Windows computer with Powershell 2.0 installed and copy it to the Retain server.

Create a batch file to transfer the files

You can use the free program WinSCP to copy from a Windows computer to a Linux server.
For example, you can create a small Windows 7 VM that only runs the Powershell script and then you can copy the exchangeuser.csv and exchangegroup.csv to the Retain server.
However, it would be a good thing to automate the process and WinSCP allows you to do that.

You can use as the basis of a batch file to copy the resulting csv files to the Retain server.
Here is an example that we used:

"C:\Program Files (x86)\WinSCP\" /command ^
    "option batch abort" ^
    "option confirm off" ^
    "open scp://user:password@retain server address" ^
    "cd /opt/beginfinite/retain/RetainServer/WEB-INF/cfg" ^
    "option transfer binary" ^
    "put file location on windows\*.csv" ^
    "close" ^

Explanation of what each line does:

#Specify that all commands are run on the command line, while using ^ to split long lines for readability.
    "C:\Program Files (x86)\WinSCP\" /command ^

# Automatically abort script on errors
    "option batch abort" ^
# Disable overwrite confirmations that conflict with the previous
    "option confirm off" ^
# Connect replacing your own username, password and retain server address WITHOUT the brackets
    "open scp://[user]:[password]@[retain server address]" ^
# Change remote directory
    "cd /opt/beginfinite/retain/RetainServer/WEB-INF/cfg" ^
# Force binary mode transfer
    "option transfer binary" ^
# Upload the file to current working directory.  Again, without brackets
    "put [file location on windows]*.csv" ^
# Disconnect
    "close" ^
# Exit WinSCP

Automate the Script
You can now automate the running of this batch file in Task Scheduler as a simple task to run before the Retain archive job.
See Also:

Additional Information

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