Posted on 03-24-2023 09:53 AM
Jamf noob here, I need to copy a file to a single mac computer in the /library/application support folder using Jamf Pro. I have a copy of the file.
I have gone into settings- scripts and I'm trying to write a script with a simple CP terminal command, but how do I supply the file? Do I need to create a package for that?
I should mention that I am working from home on a PC and don't have access to a Mac at the moment. So I think that means I can't use Composer?
Posted on 03-24-2023 09:55 AM
your best bet would be to made a dmg package from Composer and deploy the package.
Posted on 03-24-2023 09:59 AM
Posted on 03-24-2023 11:09 AM
if the file is a config that is text you could do it all in a script.. if the file is binary.. best use above..
Posted on 03-24-2023 12:53 PM
While you CAN do this... not really what Jamf is designed for. Copy a file to 1,000 machines is a whole lot more in-line.
Yes, you would need to create a package, and then you'd need to upload your package and create a policy to deploy it. But if you're at home on a Windows machine, you don't have many options.
Posted on 03-24-2023 06:31 PM
If you are limited to using a windows machine and cannot create a proper pkg or dmg to deploy then I would suggest embedding the file you need to copy into a script.
If the file is a text file (or any text based format), you can simply use a here string to create a copy of the file on disk. For example,
#!/bin/zsh
FILE_PATH="/Library/Application Support/your_file_name"
cat <<"EOF" >${FILE_CONTENTS}
{{Put your script here exactly as you would in a file.}}
EOF
echo -n "$FILE_CONTENTS" > "$FILE_PATH"
If the file you are copying is not text based then it gets a bit more complicated but still possible. See this post: How to embed a binary file in a bash shell script
Once you have the script, you can past it directly into Jamf's UI and create a policy to run it on the machine. It's not an ideal solution, but it should get it done.