Code Monkey home page Code Monkey logo

jssapiscripts's Introduction

#JSSAPIScripts

JSS Utility scripts featuring the JAMF API by Jeffrey Compton

Table of Contents

Created by gh-md-toc

What's New

10/06/2016 - JSS Migration Utility Version 1.22 Released

Changed two curl (GET) commands to include '-H "Accept: text/xml"' instruction to avoid "-:1: parser" errors. Thank you ThomasHolbrook and talkingmoose

09/09/2016 - JSS Migration Utility Version 1.21 Released

More fixes provided by talkingmoose and @andyincali. Huge Thanks! Fixed issue when posting larger files.

08/22/2016 - JSS Migration Utility Version 1.2 Released

  1. Added resource - SITES !
  2. Several dialogues are now more forgiving. For example, an operator may now type “yes” instead of “y” and still get desired results. (Changed several “if” conditions to “case” conditions)
  3. After spot-checking parsed XML for each resource, if operator does not wish to continue, program returns to main menu instead of exiting.
  4. Fixed a bug in manual upload function where main menu would display twice.
  5. Improved wording in some dialogs, and more informative comments.
  6. When working with the policies resource, operator is given an option to omit users and group based limitations. Previously, these were omitted by default. Credit Lotusshaney. He actually created a branch where there were two separate options on main menu for policies: one that included user and group based limitations and one that did not. I simply took his idea and added an extra dialogue in the main policies function.
  7. Also includes fixes by talkingmoose. He updated the curl commands several weeks ago to fix random curl errors.

Version 1.2

The JSS Migration Utility uses the JAMF API to download resources from a source JSS and upload those resources to a destination JSS. The utiltiy does NOT migrate computers.

This utilty was presented at the 2015 JAMF Nation User Conference. The video demo begins at approximately the 12 minute mark.

The primary goal and use-case for this utiltiy is to provide a mechanism where a JAMF admin can set up a barebones, clean JSS and import management resources (categories, scripts, extension attributes, computer groups, etc.) from another JSS instance. This is perhaps most helpful when circumstances (e.g. a crufty database) prevent JSS migration via the usual process - a database restore.

Basic Process:

  1. Run this utility from your local Mac
  2. XML files are downloaded from source JSS to local system
  3. XML files are parsed, depending on the current resource
  4. XML files are then uploaded to destination JSS

WARNINGS:

For this to work correctly, some data must be stripped from the downloaded XML before uploading to new server. This occurs during the parsing process. Before each group of resource files are parsed, a warning will display explaining what data, if any, will be stripped. For example, before the ldapservers resource files are parsed, you will see this message --

Passwords for authenticating to LDAP will NOT be included! You must enter passwords for LDAP in web app

Local File System:

By default, XML files are stored to ~/Desktop/JSS_Migration Before work begins on each resource, the utility looks for the presence of any previously downloaded resources and archives to ~/Desktop/JSS_Migration/archives if necessary

Casper Admins aren't perfect. Sometimes we forget to save all the icons we use for Self Service policies. After all - they are in the JSS. But if you have to stand up a separate JSS or a new one from scratch - you may need to get those.

This script finds all Self Service policies in your JSS and downloads the icons for each.

But what if we have uploaded the same icon more than once? You then have multiple versions of the same icon, each slightly different - different resolution, new style, etc.

No worries - this script will ensure that all flavors of the same icon are downloaded.
The file name will be appended with a "-" and the policy ID, ensuring all versions of same icon are downloaded.

But wait! There's more! At the end of the download process, you will be asked if you want to rename each file with a resolution indicator. That way you can more easily find the right version of the icon you are looking for.

This tool simply generates a long comma-separated value list of computer serial numbers and static group memberships. (Run locally from your Mac)

You must manually enter which static groups you want to query. See comments in script for more details.

Each line in the output will look like --

FAK3APLS3RL1,StaticGroup01

Important NOTE: If your static group names have spaces or other special characters, you must manually replace with appropriate URL encoding handlers. (e.g. "%20" for space) Your static groups can NOT have commas in them.

This is designed as a use-only-once script. The idea is to run this against your OLD JSS to generate a list you can paste into the addComputerToStaticGroupOnEnroll.bash script, which will be run once per computer on enrollment. See below for more info.

This script is designed to be uploaded to your new JSS and run as a policy with enrollment event.

As computers enroll in your new JSS, they will put themselves back into appropriate static groups.

For security reasons - API credentials are not stored in the script. They are set as parameters to be defined in your policy.

For a version of this script that you can download straight into your JSS, download addMacToStaticGroupOnEnroll.bash.xml instead.

Casper Admins are sometimes known to be pack rats. We disable policies but keep them in the JSS for ages "just in case." Sometimes we even create a category like "zzzzz_Disabled_Policies" so that we can keep old, inactive policies at the bottom of the policy list out of the way.

But there may come a time when you want to clean all those up and just delete them. If you are like me though, finding the time to click on each one and clicking "Delete" is just not feasible. This script allows you to purge all policies from a single category.

jssapiscripts's People

Contributors

rtrouton avatar str8outtajc avatar talkingmoose avatar tulgeywood avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

jssapiscripts's Issues

Software Update Servers no option

Hi, jssMigrationUtility.bash is great but is missing Software Update Servers so without those the Network Segments fail to import into the JSS if a SUS server has been set.

Error: Problem in assignment to software update serve

Curl Issues

On some systems it seems that when using a standard 'curl --silent -k --user' the script error's with -:1: parser error : Start tag expected, '<' not found, due to the output from curl not being valid XML, if the curl commands are updated to 'curl --silent -H "Accept: text/xml" -k --user' to force curl to include the header it seems to return correct formatted XML that then passes through without issue.

Not sure if its an issue, or something relevant on our OS(10.11.2) / JSS combination (9.8.2) but shared regardless.

Cheers,

Tom

Packages without categories fail to POST

Hey! Great tool, much appreciated.
I encountered an error where your expected behavior to strip out the " < category > " tag failed to occur, so the POST command had an invalid data point:
Example: " < category > No category assigned </ category > "

We were able to manually strip that out and POST by hand, but I figured I should pass along the error.

Thank you so much for contributing to the community!

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.