is-mdm is a tiny library inspired by LGUG2Z's article on detecting MDM. While the article uses rust, I wanted to do the same thing in JavaScript quickly and as a zero dependency module.
const isMdm = require('is-mdm')
isMdm() // will return true if we think the device is managed by MDM, otherwise will return falseCurrently, is-mdm supports both macOS and Windows. We use Node.js's process.platform to determine which platform-specific command to run to collect MDM output.
If you'd like to add support for AIX, Darwin, FreeBSD, Linux, OpenBSD, or SunOS, PRs are welcome.
Returns a boolean indicating whether or not the current device is managed by MDM.
Under the hood, isMdm() runs isMdmMacOS() or isMdmWindows(), depending on the platform detected with process.platform.