The second part of this series of posts regarding JumpCloud commands. Is installing Microsoft Office for Mac. This is to ease some of the pain from the onboarding process of new machines/users. I had a bit of help from a colleague (Thanks to Chris!) towards the end when writing this script but I got there in the end.
I set it up this command to install Word, PowerPoint and Excel individually rather than the whole Office Suite as that is all we use in my environment. However, I have added in the lines to install the entire office suite. You need to uncomment office and comment out the individual apps. You can download the different versions of each application for office from the MacAdmins website.
Now just a side note I have tested this on two different macOS Mojave test clients using the individual application Office 365 installers from MacAdmins and it worked perfectly – I take no responsibility for anything it does or does not do to your systems, however.
# Script to download, Silent Install and then clean up once installed Microsoft Word for Mac # Writen by twitter.com/richhickson # www.RichardHickson.com #Make temp folder for downloads. mkdir "/tmp/office/"; cd "/tmp/office/"; #Download Word, PowerPoint and Excel into temp folder. curl -L -o /tmp/office/word.pkg "https://go.microsoft.com/fwlink/?linkid=525134"; curl -L -o /tmp/office/powerpoint.pkg "https://go.microsoft.com/fwlink/?linkid=525136"; curl -L -o /tmp/office/excel.pkg "https://go.microsoft.com/fwlink/?linkid=525135"; #curl -L -o /tmp/office/office.pkg "https://go.microsoft.com/fwlink/?linkid=525133"; #Silent Install each application. sudo -S installer -allowUntrusted -pkg "/tmp/office/word.pkg" -target /; sudo -S installer -allowUntrusted -pkg "/tmp/office/powerpoint.pkg" -target /; sudo -S installer -allowUntrusted -pkg "/tmp/office/excel.pkg" -target /; sudo -S installer -allowUntrusted -pkg "/tmp/office/office.pkg" -target /; #Remove Temp Files sudo rm -rf "/tmp/office/";
If there are any other applications, you will find useful please leave me a comment below or on twitter @richhickson
I updated this post on 22/10 with a newer better command which does not need a webserver to download from it also removes setting the icons as this has been covered in this post. The previous command is below just FYI
So as the previous guide you need to put the setup files somewhere accessible on a webserver. I have mine hosted on a basic Linode. You could use the links directly from MacAdmins; however, if they change the script will fail.
# Script to Download, Silent Install and then clean up once installed Microsoft Word, PowerPoint and Excel for Mac # Writen by twitter.com/richhickson # www.RichardHickson.com #Make temp folder for downloads. mkdir "/tmp/office/"; cd "/tmp/office/"; #Download Word, PowerPoint, Excel or Office (uncomment out whats not needed) into temp folder. curl -o /tmp/office/word.pkg "http://somewebserver/word.pkg"; curl -o /tmp/office/powerpoint.pkg "http://somewebserver/powerpoint.pkg"; curl -o /tmp/office/excel.pkg "http://somewebserver/excel.pkg"; #curl -o /tmp/office/office.pkg "http://somewebserver/office.pkg"; #Silent Install each application. (uncomment out if you want the whole office suite) sudo -S installer -allowUntrusted -pkg "/tmp/office/word.pkg" -target /; sudo -S installer -allowUntrusted -pkg "/tmp/office/powerpoint.pkg" -target /; sudo -S installer -allowUntrusted -pkg "/tmp/office/excel.pkg" -target /; #sudo -S installer -allowUntrusted -pkg "/tmp/office/office.pkg" -target /; #Define Current User currentuser=$(ls -l /dev/console | awk '{ print $3 }') #Add Icons to Curent Users Dock sudo -u $currentuser defaults write com.apple.dock persistent-apps -array-add "<dict><key>tile-data</key><dict><key>file-data</key><dict><key>_CFURLString</key><string>/Applications/Microsoft Word.app</string><key>_CFURLStringType</key><integer>0</integer></dict></dict></dict>"; sudo -u $currentuser defaults write com.apple.dock persistent-apps -array-add "<dict><key>tile-data</key><dict><key>file-data</key><dict><key>_CFURLString</key><string>/Applications/Microsoft Excel.app</string><key>_CFURLStringType</key><integer>0</integer></dict></dict></dict>"; sudo -u $currentuser defaults write com.apple.dock persistent-apps -array-add "<dict><key>tile-data</key><dict><key>file-data</key><dict><key>_CFURLString</key><string>/Applications/Microsoft PowerPoint.app</string><key>_CFURLStringType</key><integer>0</integer></dict></dict></dict>"; #Kill Dock killall Dock; #Remove Temp Files (Temp Removed) sudo rm -rf "/tmp/office/";