Automated Google Drive installation with 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.

Installation steps

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 my_user_name@gmail.com -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.

Automated install where the end-user still needs to give access

Sometimes the technician installing Syncdocs does not know the end-user’s password. Run the following in a batch file at login, or via a deployment tool or Active Directory.
    msiexec /I Syncdocs.msi /QB-
    cd %LOCALAPPDATA%\Programs\Syncdocs
    syncdocs.exe -oauth -IAcceptTerms

This will deploy and install Syncdocs. It may ask the technician to enter his/her username and Google password if not already logged into Google:
syncdocs_install_step1
and then ask for Syncdocs to access their account.
syncdocs_install_step2

It will then minimize to the taskbar and start Syncing.

The example above will use default data storage paths and other settings. Read on for how to setup these in advance.

Installing Syncdocs for All users on the PC

By default, Syncdocs installs only on the Windows account running the installation. To install it once and make it available to all the users on the PC do this:

msiexec /i Syncdocs.msi TARGETDIR="%ProgramFiles%\Syncdocs" ALLUSERS=1
This will let both Admin and Normal Users access the installation.  Syncdocs supports multiple accounts, so the users can setup their own Google accounts, to keep data separate and private

Depending on what you want to do, you can also use the
msiexec /a Syncdocs.msi
to make an admin install.

More details on command line options

Specifying User and Password

-user username@domain.com 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.
for example:

-syncfolder “C:\Users\My Google Drive”
or
-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:
c:\Python
"c:\Users\User Name\Scanner\Images"
\\ServerName\ShareName\FolderName
%USERPROFILE%\GDrive

this will create links to these folders in your main sync path, equivalent to adding them via the menus.

Notes:

  • 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

Simple examples

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 my_user_name@gmail.com -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

<DefaultOfficeSuite>false</DefaultOfficeSuite>
with
<DefaultOfficeSuite>true</DefaultOfficeSuite>

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.

Notes

  1. A sample install script is shown below.
  2. This sample and a sample uninstall script and config file are available here.
  3. Make sure that the user has access to destination folder.
  4. You need Syncdocs version 4.27 or above.
  5. 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.
  6. Environment variables are supported on the command line and in the links file.
  7. 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\user1@gmail.com\
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 my_user_name@gmail.com -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  Troubleshooting
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
rem    required.

6 Responses to Automated Google Drive installation with Syncdocs

Leave a Reply

Your email address will not be published. Required fields are marked *