package
0.0.0-20200304162828-e34edbc7894d
Repository: https://github.com/rickt/gsuitemdm.git
Documentation: pkg.go.dev

# README

mdmtool

Overview

A command line utility enabling fast & easy MDM ops on G Suite MDM-protected mobile devices.

Requirements

Requires all G Suite MDM Cloud Functions to be setup, properly deployed and working. Change mdmtool configuration file to point to your own Cloud Function URLs and your own API key.

Actions

Actions perform the requested Admin SDK administrative operation on a mobile device.

All actions require -i IMEI or -s SN as well as -d DOMAIN, e.g.

  • Approve
    • $ mdmtool approve -i IMEI -d DOMAIN
  • Block
    • $ mdmtool block -s SN -d DOMAIN
  • Delete
    • $ mdmtool delete -i IMEI -d DOMAIN
  • Wipe
    • $ mdmtool wipe -s SN -d DOMAIN

All actions require a valid (Y/N) confirmation response before being executed, e.g.

$ mdmtool wipe -i 123456789098765 -d foo.com
WARNING: Are you sure you want to WIPE device IMEI=123456789098765 in domain foo.com? [y/n]: 

Action Types

ActionWhat it doesDetails on what it does
ApproveApproves a mobile deviceAllows a user to sign into G Suite on their mobile device
BlockBlocks a mobile deviceRemotely log out signed-in users, disable ability to login to mobile device
DeleteDeletes a mobile deviceRemoves a device from MDM; use only when replacing a mobile device with a new one
WipeRemote-wipes a mobile deviceForcibly remove all data & content from a device; device returns to factory settings

See the Mobiledevices: action Admin SDK docs for full details on G Suite MDM administrative actions.

Directory

Search for user phone numbers.

$ mdmtool dir -n doe
----------------------+----------------+------------------------------------------
Name                  | Phone Number   | Email 
----------------------+----------------+------------------------------------------
Jane Doe              | (213) 555-1212 | [email protected]
John Doe              | (323) 555-1212 | [email protected]
----------------------+----------------+------------------------------------------
Search returned 2 results.
  • Search for phone number using device owner name:
    • $ mdmtool dir -n john
  • Search for phone number using device owner email address:

Search

Search for mobile device data.

$ mdmtool search -n doe
----------------------+------------------+----------------+------------------+-----------------+---------------+--------------------+---------------
Domain                | Model            | Phone Number   | Serial #         | IMEI            | Status        | Last Sync          | Owner
----------------------+------------------+----------------+------------------+-----------------+---------------+--------------------+---------------
foo.com               | iPhone 5S        | (213) 555-1212 | ABC123ABC123     | 123456789098765 | APPROVED      | 1 hour ago         | Jane Doe
bar.com               | iPhone XR        | (323) 555-1212 | ZX81TRS80C64     | 234567890987654 | BLOCKED       | 11 hours ago       | John Doe
----------------------+------------------+----------------+------------------+-----------------+---------------+--------------------+---------------
Search returned 2 results.
  • Search using device owner name:
    • $ mdmtool search -n john
  • Search using device owner email address:
  • Search using device IMEI:
    • $ mdmtool search -i 123456789098765
  • Search using device serial number:
    • $ mdmtool search -n ZX81TRS80C64
  • Search using notes (stored in a device tracking Google Sheet):
    • $ mdmtool search -o lost
  • Search using phone number (stored in a device tracking Google Sheet):
    • $ mdmtool search -p 2135551212
  • Search using device status:
    • $ mdmtool search -t BLOCKED

Updates

  • Update Datastore
    • $ mdmtool udpatedb
  • Update Google Sheet
    • $ mdmtool updateshet

Update Types

Update TypeDetails on what it does
updatedatastoreUpdates Datastore with fresh data from Admin SDK for all devices, merge w/Google Sheet data, save to Datastore
updatesheetUpdates Google Sheet with fresh data from Datastore