Skip to main content
Jamf Nation, hosted by Jamf, is a knowledgeable community of Apple-focused admins and Jamf users. Join us in person at the ninth annual Jamf Nation User Conference (JNUC) this November for three days of learning, laughter and IT love.

Google Drive File Stream

Has anyone worked in a distribution plan for this?

I am having a little bit of a trouble figuring out a way to package and install on our workstations.

Like Comment
Order by:
SOLVED Posted: by kld0010

I did a major deployment in conjunction with a migration from Box to Google Team Drives. In order to make the transition smooth, I did it in stages.

1 - Install Google Drive File Stream via a Check-In Policy (But don't launch it). We did this because we had people using the original Google Drive sync client and didn't want to deal with double sync.

2 - I wrote a script that would run at next login on machines that had completed the Google Drive File Stream Install (Just a smart group looking for the installed app). This script would: quit Google Drive Sync, Delete the App, move ~/Google\ Drive to ~/Archive/Google\ Drive and launch Google Drive File Stream. It also did some stuff like prompt them to add a dock shortcut if they wanted etc.

The most annoying part of this was that it relied on users to reboot to kick the script and sometimes the login hooks wouldn't work. If I could do it again, I would do a hard cut and just push the script to everyone at once, but oh well.

Like
SOLVED Posted: by mccaskill

@kld0010 The installer itself, how did you package it up? Did you use Composer or just toss the installer in Casper admin?

Like
SOLVED Posted: by kld0010

We did the EAP for File Stream, I got a .pkg from Google, so I just threw that into the JSS

Like
SOLVED Posted: by bmonroe

Here's what we were using:

#!/bin/sh
################################################################################
#  ABOUT THIS PROGRAM
#
#  NAME
#    InstallGoogleFileStream.sh
#
#  SYNOPSIS
#    ./InstallGoogleFileStream.sh
#
#  DESCRIPTION
#    Downloads latest version of File Stream from Google's servers and installs
#    it for the current user. If Google Drive is detected, the application is
#    stopped and deleted, but user data is not. If data is found, a
#    notification is displayed through JAMF helper.
#
#  HISTORY
#    Version 1.0
#      Brian Monroe, 18.10.2017
################################################################################
# Set some Variables
SupportContactInfo="your system administrator."
dmgfile="GoogleDriveFileStream.dmg"
logfile="/Library/Logs/GoogleFileStreamInstallScript.log"
url="https://dl.google.com/drive-file-stream/GoogleDriveFileStream.dmg"
user=`ls -l /dev/console | cut -d " " -f 4`

# Say what we are doing
/bin/echo "`date`: Installing latest version of File Stream for $user..." >> ${logfile}

# Download All the Things
/bin/echo "`date`: Downloading the latest version of File Stream from Google's servers" >> ${logfile}
/usr/bin/curl -k -o /tmp/$dmgfile $url
/bin/echo "`date`: Mounting dmg file." >> ${logfile}
/usr/bin/hdiutil attach /tmp/$dmgfile -nobrowse -quiet

# Install the things. 
/bin/echo "`date`: Installing pkg" >> ${logfile}
/usr/sbin/installer -pkg /Volumes/Install\ Google\ Drive\ File\ Stream/GoogleDriveFileStream.pkg -target /

# Look for Google Drive
if [ -d /Applications/Google\ Drive.app/ ]; then
  /bin/echo "`date`: Found depricated version of Google Drive. Stopping Drive service." >> ${logfile}
  /usr/bin/osascript -e 'tell application "Google Drive" to quit'
  /bin/echo "`date`: Deleting Google Drive Application." >> ${logfile}
  rm -Rf /Applications/Google\ Drive.app/
  /Library/Application\ Support/JAMF/bin/jamfHelper.app/Contents/MacOS/jamfHelper  -title "Google Drive Version Found" -windowType hud -description "Google Drive Version Found" -description "While installing Google Drive File Stream we found an older version of Google Drive. Since they are not compatible, we removed the older version. However, you still have data stored in your home folder under Google Drive. These files will no longer be synced, so you should either move them or delete them. If you have any addional questions please reach out to ${SupportContactInfo}." &
fi

# Cleanup Tasks
/bin/echo "`date`: Unmounting installer disk image." >> ${logfile}
/usr/bin/hdiutil detach $(/bin/df | /usr/bin/grep "Install Google File Stream" | awk '{print $1}') -quiet
/bin/echo "`date`: Deleting temp files." >> ${logfile}
rm -fv /tmp/$dmgfile
/bin/sleep 3
/bin/echo "`date`: Launching File Stream" >> ${logfile}
open -a /Applications/Google\ Drive\ File\ Stream.app/
/bin/echo "`date`: Finished." >> ${logfile}

exit 0
Like
SOLVED Posted: by mccaskill

Great script! This will help a ton with our transition. Thank you for your contribution!

Like
SOLVED Posted: by ben.hertenstein

Thank you @bmonroe Exactly what I have been trying to accomplish. Works great in my testing.
Always got hung up on quitting google drive properly.

Like
SOLVED Posted: by bmonroe

No Problem! @ben.hertenstein and @mccaskill. I also wrote one to use with backup and sync at the same time as File Stream. You can find it here: https://github.com/azusapacificuniversity/scripts for general scripts and right here for the backup and sync script.

Like
SOLVED Posted: by musat

Is it just us? When we use Self Service to install the PKG file downloaded from Google, it always automatically launches. This makes it hard to install the program silently. I know there are command-line options for Installer, but as far as I know there are no ways to us those directly without needing to package the package with a separate installer script.

Like
SOLVED Posted: by daniel.jones

Brilliant script, thank you.

We are trying to install this silently without the popup once the install has completed, asking the users to sign in.

Does anyone have any parameters that could help me with this?

Thank you in advance

Like
SOLVED Posted: by nstrauss

If you're an AutoPkg user here's a recipe I put together. It doesn't auto-launch File Stream after install for those running into that problem. https://github.com/nstrauss/autopkg-recipes/tree/master/Google%20Drive%20File%20Stream

We uninstall Backup and Sync as a postinstall script in our install policy as well. Assumption is the user will use one or the other, and we're pushing heavily towards File Stream.

#!/bin/bash

# Kill the process with fire
killall -HUP "Backup and Sync"

# Remove the app bundle
rm -rf "/Applications/Backup and Sync.app"

# Remove the login item
osascript -e 'tell application "System Events" to delete login item "Backup and Sync from Google"'

exit 0
Like
SOLVED Posted: by msnowdon

@bmonroe I tried your script and it works great. I was wondering if there was a way to add a section to remove the old Google Drive folder(s). I have some lab machines with Google Drive on them and there would be a Google Drive folder in every user's profile.

Thanks

Mark

Like
SOLVED Posted: by bmonroe

Deleting user data always makes me super nervous.... I'm not going to update the first post for that reason, but you could easily add a single line to do what you're looking for. It would make the most sense here:

# Look for Google Drive
if [ -d /Applications/Google\ Drive.app/ ]; then
  /bin/echo "`date`: Found depricated version of Google Drive. Stopping Drive service." >> ${logfile}
  /usr/bin/osascript -e 'tell application "Google Drive" to quit'
  /bin/echo "`date`: Deleting Google Drive Application." >> ${logfile}
  rm -Rf /Applications/Google\ Drive.app/
  for folder in /Users/* ; do /bin/echo "`date`: Deleting User Data in ${folder} !!!" >> ${logfile}; rm -Rf $folder/Drive/; done
  /Library/Application\ Support/JAMF/bin/jamfHelper.app/Contents/MacOS/jamfHelper  -title "Google Drive Version Found" -windowType hud -description "Google Drive Version Found" -description "While installing Google Drive File Stream we found an older version of Google Drive. Since they are not compatible, we removed the older version. However, you still have data stored in your home folder under Google Drive. These files will no longer be synced, so you should either move them or delete them. If you have any addional questions please reach out to ${SupportContactInfo}." &
fi

I don't have a mac in front of me and I can't remember the default Drive folder name is so...

  for folder in /Users/* ; do /bin/echo "`date`: Deleting User Data in ${folder} !!!" >> ${logfile}; rm -Rf ${folder}/Drive/; done

might need to actually be edited to be:

  for folder in /Users/* ; do /bin/echo "`date`: Deleting User Data in ${folder} !!!" >> ${logfile}; rm -Rf $folder/Google\ Drive/; done

Good luck!

Like
SOLVED Posted: by msnowdon

Thanks, I'll test it out.

Like
SOLVED Posted: by brytox

Ive spent a little time working on this as well. My approach is quite similar to people above, but rather than rename the google drive folder i locked it, just incase the sync hasn't finished.

I also throw up a internal website telling people the differences, and that we will remove that google drive folder later on down the line.

Like
SOLVED Posted: by bryanoneill

i have made a little change to the script so it wil also delete Backup and Sync

you can past this under Look for Google Drive line

# Look for Backup and Sync if [ -d /Applications/Backup\ and\ Sync.app/ ]; then /bin/echo "date: Found depricated version of Backup and Sync. Stopping Drive service." >> ${logfile} /usr/bin/osascript -e 'tell application "Backup and Sync" to quit' /bin/echo "date: Deleting Backup and Sync Application." >> ${logfile} rm -Rf /Applications/Backup\ and\ Sync.app/ /Library/Application\ Support/JAMF/bin/jamfHelper.app/Contents/MacOS/jamfHelper -title "Backup and Sync Version Found" -windowType hud -description "Backup and Sync Version Found" -description "While installing Google Drive File Stream we found an older version of Google Drive. Since they are not compatible, we removed the older version. However, you still have data stored in your home folder under Google Drive. These files will no longer be synced, so you should either move them or delete them. If you have any addional questions please reach out to ${SupportContactInfo}." & fi
Like
SOLVED Posted: by mjones

@bmonroe I have been using your script and it worked perfectly when I used it for our staff. However, I am going to now make it available to the students and I would like to have it rename their old Google Drive directory from "Google Drive" to "Old Google Drive" as it makes me nervous to just have it be deleted. But at the same time, I want it to have a different name so they are not confused about which one to use until we delete the old one over the summer. I am admittedly not great at scripting and everything I've tried has failed. Do you think there is a way to do the renaming? Thanks in advance for your input.

Like
SOLVED Posted: by bmonroe

@mjones Basically you do the same thing that was listed in deleting the folder, but you rename it instead.

# Look for Google Drive
if [ -d /Applications/Google\ Drive.app/ ]; then
  /bin/echo "`date`: Found depricated version of Google Drive. Stopping Drive service." >> ${logfile}
  /usr/bin/osascript -e 'tell application "Google Drive" to quit'
  /bin/echo "`date`: Deleting Google Drive Application." >> ${logfile}
  rm -Rf /Applications/Google\ Drive.app/
  for folder in /Users/* ; do /bin/echo "`date`: Moving User Data in ${folder} !!!" >> ${logfile}; mv $folder/Drive/ $folder/OLDGoogleDrive/ ; done
  /Library/Application\ Support/JAMF/bin/jamfHelper.app/Contents/MacOS/jamfHelper  -title "Google Drive Version Found" -windowType hud -description "Google Drive Version Found" -description "While installing Google Drive File Stream we found an older version of Google Drive. Since they are not compatible, we removed the older version. However, you still have data stored in your home folder under a new folder called OLDGoogleDrive. These files will no longer be synced, so you should either move them or delete them. If you have any addional questions please reach out to ${SupportContactInfo}." &
fi

I never looked into whatever the default Drive folder name was but it might need to be

  for folder in /Users/* ; do /bin/echo "`date`: Moving User Data in ${folder} !!!" >> ${logfile}; mv $folder/Google\ Drive/ $folder/OLD\ Google\ Drive/ ; done
Like
SOLVED Posted: by jlang_remedy

@bmonroe or anyone else.

Running into an issue where some users are still saving files to their Drive even thought it stopped syncing earlier this year and hence not being backed up.

While this script will work to install Drive FS and copy/rename their old drive, is it feasible to attempt to copy those files in their OLD drive to the new drive FS after they sign-in and do an initial sync via some scripting magic? We would probably have to roll that script out via a user initiated policy in Self-service to initiate the copy and determine that if duplicate files exist to use the most recent modified version, and also skip native Gdoc files like gsheets, gdocs, gslides, etc which should always be the latest version.

Just curious on thoughts or implications for the end user to try something like that.

Like
SOLVED Posted: by jlang_remedy

.

Like
SOLVED Posted: by bmonroe

@jlang_remedy I have no idea. What I would be worried about is some sort of secret hash file information that Google stores next to the files and when you copy the old files over it hoses the copies that are in the cloud because it thinks you updated them, then you end up with corrupted data.

But maybe? ¯_(ツ)_/¯

I guess I'm just saying I wouldn't want to test it with my data, or anyone in my family. I'd rather just spend the time on the loss of bandwidth while it downloads select new copies.

Like
SOLVED Posted: by KieranD79

Great script, this works brilliant from Self Service but I'm having issues running it as a 'Check-In' policy with the latest version of Google Drive File Stream 31.0.19.0.

The download happens, it mounts to DMG, but when the installer is run it returns an error. The apps then appear to be installed but File Stream keeps closing with a "google drive file stream encountered a problem and has stopped" message after you've logged in.

It seems to be linked to a user not being logged in at the time the policy is triggered.

Anyone else had this with the latest version?

Like
SOLVED Posted: by fenlon

@KieranD79 I am getting the same error. Did you ever find a solution to resolve this?

Like