Sending the RestartDevice MDM command

Technical Articles

Solution
Application
Content Type
Technical Documentation
Utilities & Services
ft:locale
en-US

You can enter the management ID of the target computer into a command to restart the computer via MDM.

The following code sample demonstrates how to restart a computer:
curl --location --request POST 'https://JAMF_PRO_URL/api/preview/mdm/commands' \
--header 'Authorization: Bearer JAMF_PRO_AUTH_TOKEN' \
--header 'Content-Type: application/json' \
--data-raw '{
    "clientData": [
        {
            "managementId": "A9C3D1F0-DCB2-4D52-84C6-D5AD60140B04",
            "clientType": "COMPUTER"
        }
    ],
    "commandData": {
        "commandType": "RESTART_DEVICE",
        "rebuildKernelCache": "true",
        "kextPaths": [
            "kext1",
            "kext2",
            "kext3"
        ],
        "notifyUser": "true"
    }
}'
Computers are immediately restarted via MDM and the kernel cache is rebuilt to include the specified kernel extensions. If the NotifyUser key is set to true, the following scenarios dictate how the notification is displayed to users and when the computer restarts:
  • If no user is logged in to the computer, the computer immediately restarts without displaying a notification

  • If a user is currently logged in to the computer, a persistent Notification Center banner is displayed requesting them to restart the computer.

  • If Fast User Switching is enabled on the computer and the login screen is displayed, a notification is displayed to the next user that logs in requesting them to restart the computer regardless of any currently logged in user status.

  • If the computer does not have macOS 11.3 or later, the computer immediately restarts without displaying a notification.

Note:

If the user does not restart the computer, the RestartDevice MDM command is still acknowledged as successful in the computer's management history information in Jamf Pro.