Liked
Normalize Identifying Corporate Devices in Your Software

Post details
If you dual-license your software in such a way that it requires a paid license for commercial use, here are two code blobs for you. macOS pub fn mdm_enrollment() -> eyre::Result<(bool, Option<String>)> { let mut command = Command::new("/usr/bin/profiles"); command.args(["status", "-type", "enrollment"]); let stdout = command.output()?.stdout; let output = std::str::from_utf8(&stdout)?; if output.contains("MDM enrollment: No") { return Ok((false, None)); } let mut server = None; for line in output.lines() { if line.starts_with("MDM server") { server = Some(line.trim_start_matches("MDM server: ").to_string()) } } Ok((true, server)) } Windows pub fn mdm_enrollment() -> eyre::Result<(bool, Option<String>)> { let mut command = Command::new("dsregcmd"); command.args(["/status"]); let stdout = command.output()?.stdout; let output = std::str::from_utf8(&stdout)?; if !output.contains("MdmUrl") { return Ok((false, None)); } let mut server = None; for line in output.lines() { if line.contains("MdmUrl") { let line = line.trim().to_string(); server = Some(line.trim_start_matches("MdmUrl : ").to_string()) } } Ok((true, server)) } Looking at mobile device management (MDM) enrollment is not a silver bullet for identifying corporate devices running your software, but it is a good start.

This post was filed under likes.
Interactions with this post
Interactions with this post
Below you can find the interactions that this page has had using WebMention.
Have you written a response to this post? Let me know the URL:
Do you not have a website set up with WebMention capabilities? You can use Comment Parade.