How to automate Google Drive installation using Syncdocs
The Syncdocs installation wizard asks the user for various settings about their PC and Google Drive account during setup.
If you are deploying Syncdocs for your users, you can do a fully automated installation without your users having to set up anything. No wizard is shown.
It is also easy pre-configure all the settings for your users.
An automated installation script typically has these steps:
1. Installing the Syncdocs.msi package on the target PC
2. (Optional) Setting advanced features in the appsettings.xml file
3. Running Syncdocs with installation parameters set on the command line.
So a simple batch file to install Syncdocs will be:
msiexec /I Syncdocs.msi /QB-
syncdocs.exe -user [email protected] -oauth -syncfolder C:\GDrive -IacceptTerms
The first line installs Syncdocs without asking the user for any options in the setup wizard.
The second line starts Syncdocs, specifying the username, security method (OAuth), the main sync folder to use and the acceptance of the licence terms.
More details on command line options
Specifying User and Password
-user [email protected] specifies the user
-password secret specifies the user’s Google password as “secret”
-oauth specifies that OAuth should be used instead of the password.
OAuth will pop up a browser window asking the user to log in to their Google Account to give Syncdocs the Google Drive and Docs access. This way Syncdocs is only given the rights it needs and the Google account password does not need to be disclosed in the command line.
Note that -user is optional when -oauth is used, as Syncdocs will get this data from Google.
Agreeing to the licence terms
-IAcceptTerms To agree to the licence terms on behalf of your users, so they are not shown a dialogue asking them to.
To specify the main sync folder
-syncfolder option will set this. This will set the main sync folder to what you specify.
-syncfolder “C:\Users\My Google Drive”
-syncfolder “%USERPROFILE%\Some Google Files”
To add other folders (links)
To sync folders outside the main sync folder, add them via the Syncdocs menu, or specify the folders in file.
To create the links, you’ll need two things: a file with the folder names for the links and the -addpaths command:
-addpaths “C:\Install Files\links_file.txt”
links_file.txt is a standard text file with the folders you wish to link to on each line. For example it can contain these lines:
this will create links to these folders in your main sync path, equivalent to adding them via the menus.
- Make sure you specify the full path of this file, “C:\Install Files\links_file.txt” not just “links_file.txt”.
- Adding links to folders that are already symlinks or junction points is not recommended.
- Do not use a trailing slash after the folder name.
- Links folders that don’t exist will just be skipped, but the user will be shown a warning.
Putting it together
Here are some example install scripts.
msiexec /I Syncdocs.msi /QB-
Install using OAuth, main folder is “d:\tmp\test one 2 3″, add the additional folders in “d:\tmp\links\links_file.txt”
Syncdocs.exe -oauth -syncfolder "D:\tmp\test one 2 3" -addpaths "d:\tmp\links\links_file.txt" -IacceptTerms
As above, but using a specified password. This will result in a completely prompt-free install for the user.
Syncdocs.exe -user [email protected] -password secr3t -syncfolder "D:\tmp\test one 2 3" -addpaths "d:\tmp\links\links_file.txt" -IacceptTerms
Advanced Syncdocs Settings
Not everything can be specified by the command line. The Syncdocs config, appsettings.xml , contains many more settings.
For example, to set Syncdocs as the default office suite on the system, during step 2 above in the installation, replace the line
Automated install tools like Altiris, or a simple find and replace on the appsettings.xml file can change these settings.
You may also with to copy a pre-configured appsettings.xml file during step 2 of the installation.
- A sample install script is shown below.
- This sample and a sample uninstall script and config file are available here.
- Make sure that the user has access to destination folder.
- You need Syncdocs version 4.27 or above.
- Syncdocs is a .NET app. If it is the first time a .NET app like Syncdocs has been run on the PC, it may take a few seconds for Windows to initialise it.
- Environment variables are supported on the command line and in the links file.
- Syncdocs needs access to the Internet in order to work. You may need to setup a fire wall rule via “NETSH advfirewall firewall add rule name …” in order for it to work.
A sample install script
rem Batch File to demonstrate installing Syncdocs
rem The script has 3 stages:
rem 1. Install the msi package without any user intervention
rem 2. Optional. Copy the config files with any pre-configured settings
rem 3. Set user, password, agree to TOS and run Syncdocs
rem Stage 1
rem Run the installer in quite mode.
msiexec /I Syncdocs.msi /QB-
rem For “all users” on the PC: msiexec /I Syncdocs.msi /QB- ALLUSERS=1
rem Syncdocs is now installed on the PC, but not set-up. If no previous setup
rem is available, then it will ask the user for account settings etc when
rem first run, unless it is pre-configured by copying the appsettings.xml
rem file as shown below:
rem Stage 2 – optional copy advanced settings file
rem If you want to pre-configure settings for user1, fill in the xml fields
rem you want in appsettings.xml and then copy appsettings.xml for user1,
rem for example:
xcopy \\server\share\syncdocs\user1\appsettings.xml %APPDATA%\Syncdocs\[email protected]\
rem For Windows XP, use “%APPDATA%” instead of %APPDATA%
rem Use a text or xml find-and-replace util or AutoIT or Altiris to set
rem the values in the appsettings.xml file to your desire
rem Stage 3
rem Now run Syncdocs
rem For Windows 7/Vista/Server 2008, the path is %LOCALAPPDATA%\Programs\Syncdocs\Syncdocs.exe
rem For XP this will be “%ProgramFiles%”\Syncdocs\Syncdocs.exe
%LOCALAPPDATA%\Programs\Syncdocs\Syncdocs.exe -user [email protected] -password secr3t -syncfolder “D:\tmp\test one 2 3″ -addpaths “d:\tmp\links\links_file.txt” -IacceptTerms
rem If you wish to use OAuth (Google authentication) to give Syncdocs permissions
rem then use -oauth instead of -password:
rem %LOCALAPPDATA%\Programs\Syncdocs\Syncdocs.exe -oauth -IacceptTerms
rem In stage 1, make sure you have uninstalled the old version first.
rem If you see the setup prompt after stage 3, then some settings in
rem appsettings.xml are not valid for this PC (typically paths that do not exist).
rem or you are installing and older .msi file, Syncdocs version 4.27 or above is