Posted on 10-16-2017 07:26 AM
Hello I am pushing out the new Google Drive File Stream app. The app installs correctly but it does not pop up and prompt the user to login after installing. So I am trying to create a script that will open the app. The issue is that it worked on the test computer and the first 5 machines it hit. Then it started failing. Here is the script I am using.
open -a /Applications/Google Drive File Stream.app
Any ideas why this is not working.
Here is the error message.
xecuting Policy Open Drive File Stream
Running script Open Drive File Stream...
Script exit code: 1
Script result: LSOpenURLsWithRole() failed for the application /Applications/Google Drive File Stream.app with error -10810.<br/>
Error running script: return code was 1.
Solved! Go to Solution.
Posted on 10-16-2017 07:37 AM
You might want to try running the open command as the logged in user. Be default your script will be running it as root.
Here's an example:
#!/bin/bash
loggedInUser=`python -c 'from SystemConfiguration import SCDynamicStoreCopyConsoleUser; import sys; username = (SCDynamicStoreCopyConsoleUser(None, None, None) or [None])[0]; username = [username,""][username in [u"loginwindow", None, u""]]; sys.stdout.write(username + "
");'`
su -l $loggedInUser -c "open /Applications/Google Drive File Stream.app/"
Posted on 10-16-2017 07:37 AM
You might want to try running the open command as the logged in user. Be default your script will be running it as root.
Here's an example:
#!/bin/bash
loggedInUser=`python -c 'from SystemConfiguration import SCDynamicStoreCopyConsoleUser; import sys; username = (SCDynamicStoreCopyConsoleUser(None, None, None) or [None])[0]; username = [username,""][username in [u"loginwindow", None, u""]]; sys.stdout.write(username + "
");'`
su -l $loggedInUser -c "open /Applications/Google Drive File Stream.app/"
Posted on 02-22-2018 11:15 AM
Thanks Cbrewer, your script helped me get part of the job done.
Is there a way to hide or "run silently" so that the app window does not open? I am using this with a security app called zscaler, which is supposed to run without any user interaction. If users see this window open unexpectedly multiple times, it might cause panic/issues.
Posted on 05-08-2018 12:18 PM
When I use this to run this I get this error: Script result: match: Connection invalid
This is to enable OneDrive finder integration.
Thoughts?
#!/bin/bash
loggedInUser=`python -c 'from SystemConfiguration import SCDynamicStoreCopyConsoleUser; import sys; username = (SCDynamicStoreCopyConsoleUser(None, None, None) or [None])[0]; username = [username,""][username in [u"loginwindow", None, u""]]; sys.stdout.write(username + "
");'`
su -l $loggedInUser -c 'pluginkit -e use -i com.microsoft.OneDrive-mac.FinderSync'