Backup / save / export scripts using API?

Hi all,
As above is there a way to keep even the body of the scripts in Syncro backed up somewhere using the API? I managed to overwrite one of my scripts that took a while to write with the wrong data. Very annoying, and human error. But would like to perhaps backup all scripts once a day to have something to restore from for stupind fat-fingered problems such as this.

No, and I think the much more feasible solution is to write your scripts in something like vscode, and attach it to git. You’ll never lose your scripts since it will keep version history as you commit changes.

Both vscode and git are free.

1 Like

Yes, vscode and git are free.
However there are opportunities to improve efficiency and process compliance by automating the backups / saving and exporting of scripts out of Syncro.

1 Like

I totally am with platform improvements, but I disagree that this should be a Syncro issues. IMO you should be writing code/scripts in a proper IDE and saving them either to a repository, or backing up your scripts some other way. I don’t think putting that expectation on an RMM platform makes sense. I know some can export a script one at a time, which is cool, but like, I dunno, I just could never imagine writing them solely in an RMM platform and then expecting to save/back them up from there. I’ve never seen that on any of the various ones I’ve used.

If you have multiple techs with access to edit the scripts in Syncro, having a manual process recording the changes to scripts can lead to problems with process compliance.
We also have a potential situation where a hacker gains access to a MSP Tech user account in Syncro, and modifies the scripts. Runs scripts on endpoints, then reverses the changes in the scripts to hide their tracks.

If there was an automatic change history for the scripts, or the ability to back the scripts up, or export them via the API, then we will have increased ability to detect the occurance of human error or ill intent.

I wouldnt call it an issue, but I wouldnt say it should be there for backup reasons.

What I would say is that Syncro should still track when a script changes for more of an audit feature. Granted, if you are going that far… might as well track any changes as well so you also know what was change incase the change was dangerous for any reason.

If anything - the ability to have to sign off on script changes/edits… I might create a feature request for that half if that is ok:)

As for API - far as I know there isnt a way to do it. Depending on the API - it might be a good thing they don’t have any. Granted, you can still make your own web scraper to find and save them to your own will.

1 Like

Audit tracking sure, that would be nice. So and so created script. Last updated by xxxx at date/time. But that’s the extent of what I would expect from an RMM.

But again, having a git repository where all changes no matter that are committed and saved and you can go back and audit anything done, imo is a much more efficient way if you have multiple people editing the same thing.

You’re asking an RMM to track changes and be able to merge? No way. What happened when 2 people happen to open the same script on Syncro and make changes and try and save. Which one does it keep? Git is literally made for this exact sort of work.

Microsoft is adding Git support to the PowerApps editor. Perhaps this approach we can agree that would be good for Syncro to implement.
Power Apps Git Integration - Power Platform Community (microsoft.com)
This is part of a larger feature called co authoring of power apps. But in the context of this discussion, it is clear that Microsoft agrees that automated source control is important. If you watch the video, it might help. The repo, then becomes the backup and the audit log for script changes. Syncro then doesn’t need to extend the API to handle backup or export of scripts, because GitHub is doing it.

All that needs to happen is that Syncro integrate the scripting feature with GitHub. While I’m sure that isn’t trivial, integrating with GitHub is likely less work than building out all these features, backup, source control and audit log internally.

1 Like

Its been a while, but I thought github wasnt free for private use?

Also, maybe I am a bit bias coming from a software background: But couldnt just a basic system work?

  1. Write your code and save - data about who made the script and when it was crated.
  2. When user make changes, write time, date, username, in log view. Save copy of current code to historical list (code doesnt take that much space). As far as the databse goes - you just make a new one call it script_historical or whatever and add revision numbers. When someone clicks on that script - it would still act like it currently does until they click on of the historical view points that request from that new database.
  3. User doesnt like change, looks back at historical view, pulls sections back into their main code and clicks save.
  4. User make changes, write time, date, username, in log view. Save copy of current code to historical list (code doesnt take that much space).
  5. Admin sees a script being edited that shouldnt… admin look over the historical view and the user that made these changes… reverts changes from the historical view… etc etc
  6. Admin clicks “lock” on that script so no more future editing can be made unless approved by the admin (who will then click “unlock”).

Granted this is more the Audit View of things than it would be multi-user editing like Github would provide, but would cover - Backing up, historical points, and auditing time lines.

I would be happy today with at least a way to export the scripts and preserve the Syncro parameters like when you import a community script.

Git Hub is free for private and organisation use, with a 500 MB limit.
Pricing · Plans for every developer (github.com)

Agree, a system like you describe would be great and meet many of the needs.
However my impression of Syncro Development progress leaves me to believe that the Dev team is far smaller than the community needs, and not getting much love in the way of resources (people, coffee and snacks).

Therefore my assumption is that integrating with Git Hub would be a lower hurdle, than a native system as you have described.
(Excellent detailed description by the way. :smile:)

No, I understand, I was just saying, the code is already there, even for Jeff’s request about exporting the scripts. Aka, the community script section.

Would love to see them grow a bit larger than they are or at least open up some of the project for additional editing from the community:)

Thanks you everyone, for your excellent and constructive comments. I think I will look at using GIT Hub as a repo for scripts. I have a broad idea of how GIT works, but implementing it may be a slight challenge. I do use VSCODE to write scripts (on a Mac). I think I need to setup a folder on the Mac where the scripts are, then use GIT to sync that to GIT HUB which acts a remote repo? It’s the “pull requests”, “merge requests” etc, that I dont understand. If there is any simple guide for doing whats needed, please LMK

I’ve always found this article useful for if you accidentally mess something up lol.
Oh Sh*t, Git!?

But this link is basically a full online book that you can read through to do each thing, it’s quite well done.
Git Book

Oh and last one, also good as you can look for specific topics you are trying to do, like merge or combine commits, etc.

Git Flight Rules