-
-
Save jhbush/f6833724857510c49f6a to your computer and use it in GitHub Desktop.
OneDrive through Self Service
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# Author : Chris Sheppard | |
# Set up log file, folder and function | |
LOGFOLDER="/private/var/log/gov.fnal" | |
LOG=$LOGFOLDER"/OneDrive-2016-Install.log" | |
error=0 | |
if [ ! -d "$LOGFOLDER" ]; | |
then | |
mkdir $LOGFOLDER | |
fi | |
logme() | |
{ | |
# Check to see if function has been called correctly | |
if [ -z "$1" ] | |
then | |
echo $( date )" - logme function call error: no text passed to function! Please recheck code!" | |
exit 1 | |
fi | |
# Log the passed details | |
echo $( date )" - "$1 >> $LOG | |
echo "" >> $LOG | |
} | |
logme "Starting Installation of Microsoft OneDrive" | |
# Install all the packages | |
logme "Installing Microsoft OneDrive" | |
jamf policy -trigger run-onedrive-install ${LOG} | |
logme "System Events Choice" | |
osascript -e 'tell app "System Events" to display alert "Hello, To help get things setup..." message "Do you currently have the Microsoft OneDrive Application installed and a personal account activated?" as critical buttons {"Yes" , "No"} default button 2 | |
set response to button returned of the result | |
if response is "Yes" then | |
do shell script "defaults write /Library/Preferences/com.microsoft.OneDrive-mac EnableAddAccounts -bool True" | |
else if response is "No" then | |
do shell script "defaults write /Library/Preferences/com.microsoft.OneDrive-mac EnableAddAccounts -bool True" | |
do shell script "defaults write /Library/Preferences/com.microsoft.OneDrive-mac DefaultToBusinessFRE -bool True" | |
end if' | |
logme "Package installation completed." | |
osascript -e 'tell app "System Events" to display alert "Micorosft OneDrive was successfully Installed" message "You may click on the Open Link button below for instructions on how to setup OneDrive." as critical buttons {"Open Link" , "No Thanks"} default button 1 | |
set response to button returned of the result | |
if response is "Open Link" then open location "https://urltoKBarticle.com"' | |
exit 0 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment