How to run Google Drive as a Windows service

Overview

Running a scheduled import task when using DataBridge requires the usage of a cloud service like Google Drive or Dropbox. Follow this KB article to find out how to run the Google Drive app as a service. Failing to do so will make for an unreliable connection between DataBridge and the import file(s).

How to

The Google Drive desktop application which is a component of Google Apps will only run when a user is logged onto a computer. There may however be times when you want Google Drive to be running all the time with or without a user logged in. Use the below steps to configure Google Drive to run as a service.

  • Log into the server or desktop with the account that you want to run the service as and set up Google Drive as normally. Configure Google Drive to not run at startup and exit the application.

  • Download srvany.exe from the Microsoft Windows 2003 Resource Kit (available free from Microsoft). After installing the Resource Kit (default in C:\Program Files (x86)\Windows Resource Kits\Tools), copy srvany.exe into the folder where Google Drive is installed.

  • Open a windows cmd prompt (Run as Administrator) and type in the service and authentication details you want (in our case GoogleDriveSync) i.e.
    • sc create GoogleDriveSync displayName= "Google Drive Service" start= auto obj= "<domain>\<username>" password= "<password>" binPath= "C:\Program Files (x86)\Google\Drive\srvany.exe"
    • Continue when you see the message [SC] CreateService SUCCESS.

  • Go to your Start Menu, type in regedit and go to the new service (in this case GoogleDriveSync) HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\GoogleDriveSync
  • Create a subkey Parameters below in which you must create two string values:
    • Create a String Value called Application then right click on this and add the path to googledrivesync.exe (e.g C:\Program Files (x86)\Google\Drive\googledrivesync.exe)
    • Create a String Value called AppParameters with the relevant parameters for googledrivesync.exe (e.g /autostart --noshow_confirmation_dialog_on_delete)

  • From the command prompt, run net start GoogleDriveSync or start the service via the Services.msc snap-in. If everything went well, it should start successfully.

Managing the Google Drive Sync service

You can then manage Google Drive as a service. If you need to edit the settings within Drive log in as the account that the service is running under, stop the service then start Google Drive from the icon in the start menu.

When you have completed the changes to the settings close the Google Drive desktop application and start the service back up again.