Simple file copy to Mac using Jamf?

Hisboy_Elroy
New Contributor

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?

5 REPLIES 5

DBrowning
Valued Contributor II

your best bet would be to made a dmg package from Composer and deploy the package.

AJPinto
Honored Contributor II
  1. Place the file on your device in the directory you want.
  2. Open JAMF Composer, drag the files in to JAMF Composer and set the permissions and file ownership you want.
    1. You can make a .dmg or .pkg, it really does not matter for this kind of thing.
  3. Upload the .dmg or .pkg to JAMF
  4. Make a policy to deploy the .dmg or .pkg. 

jamf-42
Valued Contributor II

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.. 

T_Armstrong
Contributor

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.

TrentO
Contributor II

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.