Is there a process for downloading or copying all scripts that are stored in the JSS?
I am creating a new JSS from scratch to be used for testing. Is there a documented way of downloading all of the scripts from a JSS and then importing to another JSS?
Also, I would like to backup just the scripts on a regular basis outside of the typical JSS database backup.
Solved! Go to Solution.
I'm curious about this too. I haven't hit the migrate button yet so my scripts are still in a folder on our dist points. I like that I can see my scripts in a folder and I do back them up occasionally manually.
The REST API will give you the script contents. It downloads in XML format, wrapped in <script_contents> </script_contents> tags.
Not as easy as a copy from the distribution point, but not too horrible.
I vaguely recall seeing a script posted on someone's github that might have used the REST API. At least I think it did download all of the scripts. At the time I didn't understand it's value. Of course, now when I need it, I am not able to locate.
You could probably use this script I created awhile ago as the basis for one that would download all scripts:
It was designed to pull down Extension Attribute scripts via the API, but the concept is the same, so it can be adapted I think.
So I saved you the trouble of reworking my existing 'download EA scripts' script. Here is a version that will download all the regular scripts from your JSS. I had to remove the last section from the original script, which ran each one to check to make sure they exited successfully. This made sense when working with EA scripts, but I realized pretty quickly this was problematic for regular scripts, since those scripts may have GUI elements pop up, or install software updates or even reboot the Mac! Def don't want to run each one on your host system. :)
Anyway, here is the revised version. Run it like:
Moved to my githup page. Find the script here:
I added the 'final' version of the script to my github page, so you can grab it from there (see post above for the link)
Although I don't normally do this, I removed the one I had posted above just to prevent anyone from downloading an older version that had a few issues that needed to be tweaked. Best to just grab the one from the JSS. If I make any changes to it they'll be reflected there.
Hmm, that's actually a very good question re: does it copy them if the scripts are only stored within the db. I have a feeling it may not since there are no physical files to replicate to another DP if so.
@m.entholzner is correct. Using Casper Admin and then dragging a local folder into the lower right allows for local syncing of all Packages and Scripts. It does copy down all of the scripts that are stored in the JSS Database.
Unfortunately, it required me to wait for all 187GB of packages to verify that the scripts are copied down too. :)
@mm2270 I'll will try out your script soon! I'll mark your post as an answer once I verify the script works.
Well, that's definitely good information to know that a replication also pulls down scripts from the db. I didn't think it would do that honestly since they are not really in the "share" as physical files.
Kind of a bummer that it needs to pull down all the packages as well though. It would be nice if it was possible to do a selective replication, or is there a way? I don't do local repository syncs, so I'm not sure.
Using Casper Admin and then dragging a local folder into the lower right allows for local syncing of all Packages and Scripts.
This worked great for me as well. However, I did want to note that in my case I had to drag the folder to the lower left hand of Casper Admin.