06-22-2022 02:01 AM - edited 06-22-2022 02:05 AM
Hi all,
I have the following script which I would like to deploy via Jamf Pro at Enrolment:
#!/bin/sh
rm -rf "/Users/$USER/Templates/PPT"
curl "https://xxx.blob.core.windows.net/XXXX/XXX-PPT-Templates.zip" --create-dirs -o "/Users/$USER/Templates/PPT/XXX-PPT-Templates.zip"
echo "Unpacking..."
tar xvf "/Users/$USER/Templates/PPT/XXX-PPT-Templates.zip" -C "/Users/$USER/Templates/PPT/"
echo "Cleaning..."
rm "/Users/$USER/Templates/PPT/ADL-PPT-Templates.zip"
The purpose of the script is to deploy Microsoft Office templates to end users Mac's. For the Windows estate we have a tool called Upslide which works well however they dont have a MacOS version just yet. This is why we would like to distribute them in this way. Unless there is a better option out there in Jamf Pro?
We are using DepNotify and are calling this script at Enrolment time using a custom trigger. When the script runs I see the "Templates" folder is created in the /Users/root directory. This is expected since all scripts run as root from Jamf Pro. It seems very strange that Jamf Pro doesnt allow for running a script as the logged in user. We are moving away from Intune for MacOS management because of their lack of MacOS options. But this is something I could achieve easily in Intune. See below the option for deploying a script to MacOS from Intune:
Solved! Go to Solution.
Posted on 06-22-2022 07:48 AM
You’ll need to create the folder structure there yourself. Also, don’t worry if you’re not using Office 365. It’s for all licensed versions of Office for Mac.
Posted on 06-22-2022 07:50 AM
If you create the folder structure, the O365 applications should respect it. So, create the /Library/Application Support/Microsoft/Office365/User Content.localized/Templates folder and deploy your templates there.
Posted on 06-22-2022 02:09 AM
Maybe deploy the script to /var/tmp using composer.
Then trigger it from JAMF like this at login/recurring:
CURRENT_USER=$(/usr/bin/stat -f "%Su" /dev/console)
sudo -H -u $CURRENT_USER bash -c '/private/var/tmp/script.sh'
Might need to check the -c option again, and adjust the shell accordingly. Maybe check the .she has executable permissions for the staff group.
Could get really fancy and use conditional statements to check if they already have the templates in location already.
Posted on 06-22-2022 02:54 AM
Thanks @Qwheel! Sorry if I'm sounding like a noob here but how would you do that in Composer? Do you mean to build a package with the script inside?
Posted on 06-22-2022 03:00 AM
That’s the one ;)
plonk the script in /var/tmp
Posted on 06-22-2022 03:15 AM
Cool. Will give it a try now.
Posted on 06-22-2022 07:47 AM
If you plan to use the content on a recurring nature, so that it is available fore the script to run after a restart, then you do not want to store in any 'tmp' folder. I would suggest creating a folder somewhere, like in /var or in /Library, that is specific to your org and storing there. The contents of a 'tmp' folder may get deleted on reboot.
Posted on 06-22-2022 02:17 AM
On another note, I remember I had some issues with our auto mount of a NAS as MacOS got newer.
I think I cheated JAMF into running an Osascript as current user by having it in its own policy with a custom trigger, set to ‘Ongoing’.
The actual script that runs calls:
sudo JAMF policy -trigger triggerName
In the console application on the device it looks like “looking to run ‘policy’ as ‘user’”
Yeah, probably the wrong way to go about it, but it did the trick… so happy days.
Last note: I always had issues with using $USER, so switched to the one above ($CURRENT_USER) to assure that part actually works.
Posted on 06-22-2022 05:12 AM
There's no need to run a script to deploy Office templates to user home folders. Deploy them instead to '/Library/Application Support/Microsoft/Office365/User Content.localized/' for all users of the computer.
See this document:
Posted on 06-22-2022 06:03 AM
Hi @talkingmoose the folder /Library/Application Support/Microsoft/Office365/User Content.localized/... does not exist on my test machine where I have Office installed. The only folder in there is something called MAU2.0.
06-22-2022 06:13 AM - edited 06-22-2022 06:29 AM
Posted on 06-22-2022 07:48 AM
You’ll need to create the folder structure there yourself. Also, don’t worry if you’re not using Office 365. It’s for all licensed versions of Office for Mac.
Posted on 06-22-2022 07:50 AM
If you create the folder structure, the O365 applications should respect it. So, create the /Library/Application Support/Microsoft/Office365/User Content.localized/Templates folder and deploy your templates there.
Posted on 06-22-2022 08:02 AM
Ok I will do some testing and come back to you guys. Thanks for the help and clarification. :)
Posted on 06-22-2022 10:03 AM
So I have created the folder structure and deployed the templates there but Word is not picking them up? Are they supposed to appear in the Personal section or Work section in Word when you click New? Maybe Office needs permissions to the new folder structure or something?
Posted on 06-22-2022 10:21 AM
Nevermind. Used a chmod 555 command and this is now working! Great help @stevewood @talkingmoose !