class Jamf::ComputerGroup

A computer group in the JSS

See also the parent class Jamf::Group

@see Jamf::APIObject

@see Jamf::Group

Constants

ADD_MEMBERS_ELEMENT

the XML element for immediate member additions via PUT

MDM_COMMAND_TARGET

what kind of devices are these WRT MDM

MEMBER_CLASS

This class represents a Computer in the JSS.

Adding Computers to the JSS

At the moment, this class cannot be used to add new Computers to the JSS. Please use other methods (like the Recon App or QuickAdd package)

Editing values

Any data that arrives in the JSS via an “inventory update” (a.k.a. ‘recon’) cannot be modified through this class, or the API.

Data that can be modified are:

  • Management Account (see set_management_to)

  • asset_tag

  • barcodes 1 and 2

  • ip_address

  • udid

  • mac_address & alt_mac_address

  • serial_number Note: Even tho the webUI doesn’t allow editing the serial_number, the API does, and it can be useful for dealing with duplicates that arise when a logic-board swap causes a new computer record. to be created.

  • location data via the Locatable module

  • purchasing data via the Purchasable module

  • Extension Attribute values via the Extendable module Note: as with other ‘recon’ generated values, Ext. Attrs. populated by scripts cannot be modified via the API. (the change would be overwritten the next time the machine did a recon)

After making any changes, you must call update to send those changes to the server.

MDM Commands

See the {Jamf::MDM} mixin module for Class and Instance methods for sending MDM commands to computers.

To send MDM commands without fetching Computer instances, use the class methods, which can take multiple computer identifiers at once.

NOTE: the poorly named ‘UnmanageDevice’ mdm command is implemented as {#remove_mdm_profile} (which is its name in the webUI) as well as {#unmanage_device}. Calling that method will NOT fully unmanage a computer from the JSS’s point of view, it will just remove the mdm management profile from the machine and all configuration profiles that were installed via the JSS. Those profiles may be re-installed automatically later if the computer is still in scope for them

To properly unmanage a computer, use the {#make_unmanaged} Instance method which removes the mdm profile, but also makes the machine unmanged by the JSS, setting the management acct to nil, and requring re-enrollment.

Management History & Logs

Computer Management History and logs can now be retrieved both from a Computer instance, and directly via class methods without fetching an instance. This is handled by the mixed-in {Jamf::ManagementHistory} module, Q.V. for details.

Appication Usage History

Computer Instances now have access to their Application Usage history via the {#application_usage} method. Call the method with a start-date value (either a String or a Time object) and an optional end-date value. If you omite the end-date, the start-date is used and you’ll see usage for just that day.

See {#application_usage} for details about the data returned.

NOTE: your JSS must be gathering Appication Usage data in order for any data to be returned, and the usage history will only go back as far as your setting for flushing of Application Usage Logs.

Management Data

The computers ‘manamgement data’, as presented on the ‘Management’ tab of the computer’s detail page in the JSS web UI, is available from the {#management_data} method. That method may return a large dataset, unless a subset is requested.

Subsets of management data have their own methods, which are faster and only retrieve the subset requested. See {#smart_groups}, {#static_groups}, {#policies}, {#configuration_profiles}, {#ebooks}, {#app_store_apps}, {#restricted_software}, and {#patch_titles}

The subset methods can take an ‘only:’ parameter, which is a symbol specifying the value you care to see. For example {#smart_groups} returns an array of hashes, one for each smart_group the computer is in. Those hashes have two keys, :name, and :id. However if you only want an array of names, you can call ‘smart_groups only: :name`

When any of the manamgement data methods are used the first time, the data is read from the API and cached internally, the cache is then used for all future calls. To re-read the data from the API and re-cache it, provide ‘refresh: true` to any of the manamgement data methods.

Other Methods

  • {#set_management_to} change the management acct and passwd for this computer, aliased to make_managed

    • requires calling update to push changes to the server

  • {#make_unmanaged} an shortcut method for {#set_management_to}(nil)

    • requires calling update to push changes to the server

  • {#apps} a shortcut to {#software} [:applications]

  • {#licensed_sw} a shortcut to {#software} [:licensed_software]

  • {#computer_groups} a shortcut to {#groups_accounts} [:computer_group_memberships]

  • {#local_accounts} a shortcut to {#groups_accounts} [:local_accounts]

  • {#drives} a shortcut to {#hardware} [:storage]

  • {#printers} a shortcut to {#hardware} [:mapped_printers]

@see APIObject @see Locatable @see Purchasable @see Matchable @see FileUpload

OBJECT_HISTORY_OBJECT_TYPE

the object type for this object in the object history table. See {APIObject#add_object_history_entry}

REMOVE_MEMBERS_ELEMENT

the XML element for immediate member removals via PUT

RSRC_BASE

The base for REST resources of this class

RSRC_LIST_KEY

the hash key used for the JSON list output of all objects in the JSS

RSRC_OBJECT_KEY

The hash key used for the JSON object output. It’s also used in various error messages

Public Instance Methods

member_mac_addresses() click to toggle source

Return an array of the mac_addrs of members in this group

@return [Array<String>] the member mac addresses

   # File lib/jamf/api/classic/api_objects/computer_group.rb
96 def member_mac_addresses
97   @members.map { |m| m[:mac_address] } + @members.map { |m| m[:alt_mac_address] }
98 end
member_serial_numbers() click to toggle source

The serial numbers of members in this group

@return [Array<String>] the member serial numbers

   # File lib/jamf/api/classic/api_objects/computer_group.rb
87 def member_serial_numbers
88   @members.map { |m| m[:serial_number] }
89 end