Skip to content

feat(comp): migrate Classic computer MDM commands to modern API and add restart, shutdown, set-recovery-lock - #74

Merged
neilmartin83 merged 2 commits into
feat/mobile-mdm-commandsfrom
feat/computer-mdm-commands
Apr 6, 2026
Merged

feat(comp): migrate Classic computer MDM commands to modern API and add restart, shutdown, set-recovery-lock#74
neilmartin83 merged 2 commits into
feat/mobile-mdm-commandsfrom
feat/computer-mdm-commands

Conversation

@neilmartin83

Copy link
Copy Markdown
Member

Summary

Applies the same Classic → Modern API migration rules as #72, now for computer MDM commands.

Migrated (Classic → Modern)

Command Classic endpoint Classic status Modern commandType
lock /JSSResource/computercommands/command/DeviceLock/id/{id} Exists in modern DEVICE_LOCK
enable-remote-desktop /JSSResource/computercommands/command/EnableRemoteDesktop/id/{id} Deprecated 2025-07-10 ENABLE_REMOTE_DESKTOP
disable-remote-desktop /JSSResource/computercommands/command/DisableRemoteDesktop/id/{id} Deprecated 2025-07-10 DISABLE_REMOTE_DESKTOP

New commands

Command commandType Notes
restart RESTART_DEVICE Optional --rebuild-kernel-cache flag
shutdown SHUT_DOWN_DEVICE
set-recovery-lock SET_RECOVERY_LOCK Optional --new-password; omit to clear

sendMDMCommand retained in pro_bulk.go — still needed by bulk send-command operation.

Test plan

  • All unit tests pass (make test)
  • restart, enable-remote-desktop, disable-remote-desktop, lock, shutdown (dry-run), set-recovery-lock live-tested on nmartin.jamfcloud.com — all returned command UUIDs
  • TestComputerActionSubcommands_Exist covers all 12 computer action commands
  • TestSendComputerModernMDMCommand_Success asserts correct commandType and managementId in request body
  • TestSendComputerModernMDMCommand_MissingManagementID asserts correct error

Closes #73

🤖 Generated with Claude Code

…dd restart, shutdown, set-recovery-lock

Migrated from deprecated Classic API to modern POST /v2/mdm/commands:
- lock → DEVICE_LOCK
- enable-remote-desktop → ENABLE_REMOTE_DESKTOP (Classic deprecated 2025-07-10)
- disable-remote-desktop → DISABLE_REMOTE_DESKTOP (Classic deprecated 2025-07-10)

New commands:
- restart (RESTART_DEVICE) — optional --rebuild-kernel-cache flag
- shutdown (SHUT_DOWN_DEVICE)
- set-recovery-lock (SET_RECOVERY_LOCK) — optional --new-password; omit to clear

sendMDMCommand retained in pro_bulk.go for the bulk send-command operation only.

Closes #73

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@neilmartin83
neilmartin83 requested a review from ktn-jamf as a code owner April 6, 2026 08:34
Setting an unknown Recovery Lock password can permanently lock a user
out of their machine. Require --yes (single device) and --confirm-destructive
(bulk) consistent with other destructive operations like lock and erase.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@neilmartin83
neilmartin83 merged commit a8bad28 into feat/mobile-mdm-commands Apr 6, 2026
@neilmartin83
neilmartin83 deleted the feat/computer-mdm-commands branch April 6, 2026 08:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant