Environment
Retain 3.x
Exchange Module
O365
Situation
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?
Resolution
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 windscp.com as the basis of a batch file to copy the resulting csv files to the Retain server.
Here is an example that we used:
retain.bat
"C:\Program Files (x86)\WinSCP\winscp.com" /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" ^
"exit"
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\winscp.com" /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
"exit"
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: