module Jamf::MDM

This module provides the ability to work with MDM commands for objects that can receive them.

Objects mixing in this module MUST:

Constants

ALL_DEVICE_COMMANDS

The MDM commands applicable to all mobile devices

BLANK_PUSH

Both computers & devices

BLANK_PUSH_RESULT
CLEAR_PASSCODE
CLEAR_RESTRICTIONS_PASSWORD
COMMANDS

Symbols that can be used to represent the commands to the {.send_mdm_command} Class method. Alternates are provided to match both the actual API command, and the command label in the JSS web UI, as well as common variants. e.g. the DeviceLock command in the API, is recognized as: :device_lock and :lock_device, and just :lock

COMMAND_DATA

Command Data

COMMAND_ELEMENT
COMPUTER_COMMANDS

The MDM commands applicable to computers

COMPUTER_COMMAND_ELEMENT
COMPUTER_COMMAND_UDID_ELEMENT
COMPUTER_ID_ELEMENT
COMPUTER_RSRC

The API resource for sending computer commands

COMPUTER_TARGETS

These targets are computers

DELETE_USER

computers only

DEVICE_COMMANDS

The MDM commands applicable to mobile devices

DEVICE_COMMAND_ELEMENT
DEVICE_COMMAND_STATUS_ELEMENT
DEVICE_ID_ELEMENT
DEVICE_LIST_ELEMENT
DEVICE_LOCATION
DEVICE_LOCK
DEVICE_NAME
DEVICE_RSRC

the API resource for sending device commands

DEVICE_TARGETS

These targets are mobile devices

DISABLE_APP_ANALYTICS
DISABLE_DATA_ROAMING
DISABLE_DIAGNOSTIC_SUBMISSION
DISABLE_LOST_MODE
DISABLE_REMOTE_DESKTOP
DISABLE_VOICE_ROAMING
ENABLE_APP_ANALYTICS
ENABLE_DATA_ROAMING
ENABLE_DIAGNOSTIC_SUBMISSION
ENABLE_LOST_MODE
ENABLE_REMOTE_DESKTOP
ENABLE_VOICE_ROAMING
ERASE_DEVICE
FAILED_STATUS

the status to flush for ‘failed’

FLUSHABLE_STATUSES
GENERAL_ELEMENT

xml elements

GROUP_TARGETS

These targets are groups, and need their member ids expanded for sending commands

PASSCODE_LOCK_GRACE_PERIOD

shared ipads only

PENDINGFAILED_STATUS

the status to flush for both pending and failed

PENDING_STATUS

the status to flush for ‘pending’

PLAY_LOST_MODE_SOUND
RESTART_DEVICE
SETTINGS

devices

SHUTDOWN_DEVICE
SUPERVISED_DEVICE_COMMANDS

The MDM commands applicable to supervised mobile devices

TARGET_ID_ELEMENT
UNLOCK_USER_ACCOUNT
UNMANGE_DEVICE
UPDATE_INVENTORY
WALLPAPER

supervised devices

WALLPAPER_LOCATIONS

Public Class Methods

included(klass) click to toggle source

Extend ourself when included @see {Jamf::MDM::ClassMethods}

     # File lib/jamf/api/classic/api_objects/mdm.rb
1101 def self.included(klass)
1102   klass.extend Jamf::MDM::ClassMethods
1103 end

Public Instance Methods

blank_push() click to toggle source

Send a blank push to this object

@return [void]

     # File lib/jamf/api/classic/api_objects/mdm.rb
1118 def blank_push
1119   self.class.send_blank_push @id, cnx: @cnx
1120 end
Also aliased as: send_blank_push, noop
clear_passcode() click to toggle source

Send an clear_passcode command to this object

@return (see .send_mdm_command)

     # File lib/jamf/api/classic/api_objects/mdm.rb
1222 def clear_passcode
1223   self.class.clear_passcode @id, cnx: @cnx
1224 end
clear_restrictions_password() click to toggle source

Send an clear_restrictions_password command to this object

@return (see .send_mdm_command)

     # File lib/jamf/api/classic/api_objects/mdm.rb
1230 def clear_restrictions_password
1231   self.class.clear_restrictions_password @id, cnx: @cnx
1232 end
delete_user(user) click to toggle source

Send a delete_user command to this computer or group

@param user the username of the acct to delete

@return (see .send_mdm_command)

     # File lib/jamf/api/classic/api_objects/mdm.rb
1184 def delete_user(user)
1185   self.class.delete_user @id, user, cnx: @cnx
1186 end
device_lock(passcode_or_message = '') click to toggle source

Send a dev lock to this object

@param passcode_or_message a six-char passcode, required for computers & computergroups

Or an optional message to display on mobiledevices & mobiledevicegroups

@return (see .send_mdm_command)

     # File lib/jamf/api/classic/api_objects/mdm.rb
1131 def device_lock(passcode_or_message = '')
1132   self.class.device_lock @id, passcode: passcode_or_message, message: passcode_or_message, cnx: @cnx
1133 end
Also aliased as: lock, lock_device
device_name(name) click to toggle source

Send a device_name command to this object

@param name The new name

@return (see .send_mdm_command)

     # File lib/jamf/api/classic/api_objects/mdm.rb
1279 def device_name(name)
1280   self.class.device_name @id, name, cnx: @cnx
1281 end
Also aliased as: set_name, set_device_name
disable_app_analytics() click to toggle source

Send a disable_app_analytics command to this object

@return (see .send_mdm_command)

     # File lib/jamf/api/classic/api_objects/mdm.rb
1349 def disable_app_analytics
1350   self.class.disable_app_analytics @id, cnx: @cnx
1351 end
disable_data_roaming() click to toggle source

Send a disable_data_roaming command to this object

@return (see .send_mdm_command)

     # File lib/jamf/api/classic/api_objects/mdm.rb
1246 def disable_data_roaming
1247   self.class.disable_data_roaming @id, cnx: @cnx
1248 end
disable_diagnostic_submission() click to toggle source

Send a disable_diagnostic_submission command to this object

@return (see .send_mdm_command)

     # File lib/jamf/api/classic/api_objects/mdm.rb
1365 def disable_diagnostic_submission
1366   self.class.disable_diagnostic_submission @id, cnx: @cnx
1367 end
disable_lost_mode() click to toggle source

Send a disable_lost_mode command to this object

@return (see .send_mdm_command)

     # File lib/jamf/api/classic/api_objects/mdm.rb
1414 def disable_lost_mode
1415   self.class.disable_lost_mode @id, cnx: @cnx
1416 end
disable_remote_desktop() click to toggle source

Send a disable_remote_desktop command to this computer or group

@return (see .send_mdm_command)

     # File lib/jamf/api/classic/api_objects/mdm.rb
1200 def disable_remote_desktop
1201   self.class.disable_remote_desktop @id, cnx: @cnx
1202 end
disable_voice_roaming() click to toggle source

Send a disable_voice_roaming command to this object

@return (see .send_mdm_command)

     # File lib/jamf/api/classic/api_objects/mdm.rb
1262 def disable_voice_roaming
1263   self.class.disable_voice_roaming @id, cnx: @cnx
1264 end
enable_app_analytics() click to toggle source

Send an enable_app_analytics command to this object

@return (see .send_mdm_command)

     # File lib/jamf/api/classic/api_objects/mdm.rb
1341 def enable_app_analytics
1342   self.class.enable_app_analytics @id, cnx: @cnx
1343 end
enable_data_roaming() click to toggle source

Send an enable_data_roaming command to this object

@return (see .send_mdm_command)

     # File lib/jamf/api/classic/api_objects/mdm.rb
1238 def enable_data_roaming
1239   self.class.enable_data_roaming @id, cnx: @cnx
1240 end
enable_diagnostic_submission() click to toggle source

Send an enable_diagnostic_submission command to this object

@return (see .send_mdm_command)

     # File lib/jamf/api/classic/api_objects/mdm.rb
1357 def enable_diagnostic_submission
1358   self.class.enable_diagnostic_submission @id, cnx: @cnx
1359 end
enable_lost_mode( message: nil, phone: nil, footnote: nil, enforce_lost_mode: false, play_sound: false ) click to toggle source

Send a enable_lost_mode command to one or more targets

Either or both of message and phone number must be provided

@param message The message to display on the lock screen

@param phone_number The phone number to display on the lock screen

@param footnote Optional footnote to display on the lock screen

@param play_sound Play a sound when entering lost mode

@param enforce_lost_mode Re-enable lost mode when re-enrolled after wipe. Default is false

@return (see .send_mdm_command)

     # File lib/jamf/api/classic/api_objects/mdm.rb
1385 def enable_lost_mode(
1386   message: nil,
1387   phone: nil,
1388   footnote: nil,
1389   enforce_lost_mode: false,
1390   play_sound: false
1391 )
1392   self.class.enable_lost_mode(
1393     @id,
1394     message: message,
1395     phone: phone,
1396     footnote: footnote,
1397     play_sound: play_sound,
1398     enforce_lost_mode: enforce_lost_mode, cnx: @cnx
1399   )
1400 end
enable_remote_desktop() click to toggle source

Send an enable_remote_desktop command to this computer or group

@return (see .send_mdm_command)

     # File lib/jamf/api/classic/api_objects/mdm.rb
1192 def enable_remote_desktop
1193   self.class.enable_remote_desktop @id, cnx: @cnx
1194 end
enable_voice_roaming() click to toggle source

Send an enable_voice_roaming command to this object

@return (see .send_mdm_command)

     # File lib/jamf/api/classic/api_objects/mdm.rb
1254 def enable_voice_roaming
1255   self.class.enable_voice_roaming @id, cnx: @cnx
1256 end
erase(passcode = '', preserve_data_plan: false)
Alias for: erase_device
erase_device(passcode = '', preserve_data_plan: false) click to toggle source

Send an erase device command to this object

@param passcode a six-char passcode, required for computers & computergroups

@return (see .send_mdm_command)

     # File lib/jamf/api/classic/api_objects/mdm.rb
1143 def erase_device(passcode = '', preserve_data_plan: false)
1144   self.class.erase_device @id, passcode: passcode, preserve_data_plan: preserve_data_plan, cnx: @cnx
1145 end
Also aliased as: wipe_device, wipe_computer, wipe, erase
flush_mdm_commands(status) click to toggle source

flush pending and/or failed MDM commands for this object

@param status a key from {Jamf::Commandable::FLUSHABLE_STATUSES}

@return [void]

     # File lib/jamf/api/classic/api_objects/mdm.rb
1427 def flush_mdm_commands(status)
1428   self.class.flush_mdm_commands @id, status: status, cnx: @cnx
1429 end
lock(passcode_or_message = '')
Alias for: device_lock
lock_device(passcode_or_message = '')
Alias for: device_lock
noop()
Alias for: blank_push
passcode_lock_grace_period(secs) click to toggle source

Send a passcode_lock_grace_period command to this object

@param secs The numer of seconds for the grace period

@return (see .send_mdm_command)

     # File lib/jamf/api/classic/api_objects/mdm.rb
1313 def passcode_lock_grace_period(secs)
1314   self.class.passcode_lock_grace_period @id, secs, cnx: @cnx
1315 end
play_lost_mode_sound() click to toggle source

Send a play_lost_mode_sound command to this object

@return (see .send_mdm_command)

     # File lib/jamf/api/classic/api_objects/mdm.rb
1406 def play_lost_mode_sound
1407   self.class.play_lost_mode_sound @id, cnx: @cnx
1408 end
recon()
Alias for: update_inventory
remove_mdm_profile()
Alias for: unmanage_device
restart()
Alias for: restart_device
restart_device() click to toggle source

Send a restart_device command to this object

@return (see .send_mdm_command)

     # File lib/jamf/api/classic/api_objects/mdm.rb
1332 def restart_device
1333   self.class.restart_device @id, cnx: @cnx
1334 end
Also aliased as: restart
send_blank_push()
Alias for: blank_push
set_device_name(name)
Alias for: device_name
set_name(name)
Alias for: device_name
set_wallpaper(wallpaper_setting: nil, wallpaper_content: nil, wallpaper_id: nil)
Alias for: wallpaper
shut_down()
Alias for: shut_down_device
shut_down_device() click to toggle source

Send a shut_down_device command to this object

@return (see .send_mdm_command)

     # File lib/jamf/api/classic/api_objects/mdm.rb
1321 def shut_down_device
1322   self.class.shut_down_device @id, cnx: @cnx
1323 end
Also aliased as: shutdown_device, shut_down, shutdown
shutdown()
Alias for: shut_down_device
shutdown_device()
Alias for: shut_down_device
unlock_user_account(user) click to toggle source

Send an unlock_user_account command to this computer or group

@param user the username of the acct to unlock

@return (see .send_mdm_command)

     # File lib/jamf/api/classic/api_objects/mdm.rb
1174 def unlock_user_account(user)
1175   self.class.unlock_user_account @id, user, cnx: @cnx
1176 end
unmanage_device() click to toggle source

Send an unmanage device command to this object

NOTE: when used with computers, the mdm profile will probably be re-installed immediately unless the computer is also no longer managed by Jamf Pro itself. To fully unmanage a computer, use the {Jamf::Computer#make_unmanaged} instance method.

@return (see .send_mdm_command)

     # File lib/jamf/api/classic/api_objects/mdm.rb
1160 def unmanage_device
1161   self.class.unmanage_device @id, cnx: @cnx
1162 end
Also aliased as: remove_mdm_profile
update_inventory() click to toggle source

Send an update_inventory command to this object

@return (see .send_mdm_command)

     # File lib/jamf/api/classic/api_objects/mdm.rb
1213 def update_inventory
1214   self.class.update_inventory @id, cnx: @cnx
1215 end
Also aliased as: recon
wallpaper(wallpaper_setting: nil, wallpaper_content: nil, wallpaper_id: nil) click to toggle source

Send a wallpaper command to this object

@param wallpaper_setting :lock_screen, :home_screen, or :lock_and_home_screen

@param wallpaper_content The local path to a .png or .jpg to use

as the walpaper image, required if no wallpaper_id

@param wallpaper_id The id of an Icon in Jamf Pro to use as the wallpaper image,

required if no wallpaper_content

@return (see .send_mdm_command)

     # File lib/jamf/api/classic/api_objects/mdm.rb
1297 def wallpaper(wallpaper_setting: nil, wallpaper_content: nil, wallpaper_id: nil)
1298   self.class.wallpaper(
1299     @id,
1300     wallpaper_setting: wallpaper_setting,
1301     wallpaper_content: wallpaper_content,
1302     wallpaper_id: wallpaper_id, cnx: @cnx
1303   )
1304 end
Also aliased as: set_wallpaper
wipe(passcode = '', preserve_data_plan: false)
Alias for: erase_device
wipe_computer(passcode = '', preserve_data_plan: false)
Alias for: erase_device
wipe_device(passcode = '', preserve_data_plan: false)
Alias for: erase_device