Code Monkey home page Code Monkey logo

staticgroupfromsearch's Introduction

Static Group from Search

Description


This Python script performs a search on a JSS using the '/match' API endpoint for Computers or Mobile Devices and creates a Static Group of the results.

The script takes arguments and contains built-in help text.

Usage


A single phrase can be passed as the search criteria or a list provided in CSV format. Any searchable criteria for an inventory record can be used along with wild card values (*).

CSV lists can contain a mix of values such as usernames, email addresses, serial numbers, MAC addresses, etc. Your CSV file should be formatted as a single column without a header:

value1
value2
value3

Passing an asterisk (*) as the criteria will return all device records.

Help Text


Script help text show here:

usage: StaticGroupFromSearch [-h] (-c | -m) (-f FILE | -s SEARCH)
                             [-u USERNAME] [-p PASSWORD]
                             jssurl groupname

Use the '/match' endpoint for Computers and Mobile devices to generate Static Groups.

positional arguments:
  jssurl                JSS URL
  groupname             new static group name

optional arguments:
  -h, --help            show this help message and exit
  -c, --computers       search computers
  -m, --mobiledevices   search mobile devices
  -f FILE, --csv-file FILE
                        read search values from csv file
  -s SEARCH, --search SEARCH
                        search for a value
  -u USERNAME, --username USERNAME
                        API username
  -p PASSWORD, --password PASSWORD
                        API user password

Example usage:
$ ./StaticGroupFromSearch.py https://jss.myorg.com "Contains 'iPhone'" -u 'user' -p 'pass' --mobiledevices -s '*iPhone*'
$ ./StaticGroupFromSearch.py https://jss.myorg.com "Starts with 'admin'" --computers --search 'admin*'
$ ./StaticGroupFromSearch.py https://jss.myorg.com "Devices from list" --mobiledevices --csv-file /path/to/list.csv.csv

staticgroupfromsearch's People

Contributors

brysontyrrell avatar homebysix avatar

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.