Posted on 06-01-2015 06:29 AM
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.
Posted on 06-08-2015 06:18 AM
Another simple way: use Casper Admin to create a local repository and all scripts will be there :)
Posted on 06-01-2015 06:32 AM
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.
Posted on 06-01-2015 06:45 AM
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.
Posted on 06-01-2015 06:48 AM
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.
Posted on 06-01-2015 06:49 AM
You could probably use this script I created awhile ago as the basis for one that would download all scripts:
https://github.com/mm2270/UpdateExtensionAttributes/blob/master/download-extension-attributes.sh
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.
Posted on 06-01-2015 08:06 AM
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:
https://github.com/mm2270/CasperSuiteScripts/blob/master/download_jss_scripts.sh
Posted on 01-09-2023 01:29 AM
@mm2270earlier i was able to get the script from jss but now im not able to get the scripts from jss can you help me on this.
Posted on 06-01-2015 12:49 PM
Thanks for the responses. I'll try out @mm2270's script and followup if it works or not.
Posted on 06-01-2015 12:55 PM
@jhalvorson you may want to wait on using the script. I found a few minor issues with the version I posted here. I'll post an updated one either here or on my github page a little later that works more reliably.
Posted on 06-01-2015 09:05 PM
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.
Posted on 06-08-2015 06:18 AM
Another simple way: use Casper Admin to create a local repository and all scripts will be there :)
Posted on 06-08-2015 07:05 AM
@m.entholzner good to know. Do you have to replicate the DP to the local drive to get them? Does it still copy them if the scripts are stored in the database?
Posted on 06-08-2015 07:11 AM
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.
Posted on 06-09-2015 01:54 AM
@davidacland: yes, the DP replication will get all files from the fileshare as well as the scripts stored in the database.
Posted on 06-09-2015 02:35 AM
@m.entholzner thanks for the confirmation, definitely good to know!
Posted on 06-10-2015 08:34 AM
@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.
Posted on 06-10-2015 08:44 AM
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.
Posted on 01-14-2016 07:18 AM
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.