Registering DetectX Swift with a Munki NoPkg

During a discussion in the #detectx channel of the MacAdmins Slack yesterday AP Orlebeke pointed out that when registering a DetectX Swift (DTXS) Pro or Management license via the command line it is only applied for users that already exist on the system. DetectX Swift will be in an unregistered state for any users created later.

In the ensuing discussion I opined that: “It would be trivial to whip up a Munki on-demand NoPkg that triggers the command line registration as root if the user ever got in a situation where they were using the DetectX GUI and were unregistered.”

DetectX developer Phil Stokes asked if I’d be willing to create an example so I did just that. Read on for the details.

I had never run across this scenario before because we’re almost entirely 1:1 at the newspaper plus I include the registration script as a Munki postinstall for every version of DTXS in my repo. This means even if a new user is created on an existing computer they would only be unregistered until the next DTXS update.

Below is the NoPkg you can copy into your Munki repo, simply edit in your serial number and email address. With this any standard user can register DTXS on demand via Managed Software Center without needing you to connect to their computer.

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
	<key>OnDemand</key>
	<true/>
	<key>_metadata</key>
	<dict>
		<key>created_by</key>
		<string>kevinmcox</string>
		<key>creation_date</key>
		<date>2019-01-11T17:17:44Z</date>
		<key>munki_version</key>
		<string>3.6.0.3696</string>
		<key>os_version</key>
		<string>10.13.6</string>
	</dict>
	<key>autoremove</key>
	<false/>
	<key>blocking_applications</key>
	<array>
		<string>DetectX Swift.app</string>
	</array>
	<key>catalogs</key>
	<array>
		<string>testing</string>
		<string>beta</string>
		<string>live</string>
	</array>
	<key>category</key>
	<string>Self-Service</string>
	<key>description</key>
	<string>Run this action to register DetectX Swift if the application reports that it is unregistered. (There will be no visible signs that this registration is taking place and you may safely close Managed Software Center after clicking Install.)</string>
	<key>developer</key>
	<string>Kevin M. Cox</string>
	<key>display_name</key>
	<string>DetectX Registration</string>
	<key>icon_name</key>
	<string>DetectX Swift.png</string>
	<key>installer_type</key>
	<string>nopkg</string>
	<key>minimum_os_version</key>
	<string>10.11</string>
	<key>name</key>
	<string>DetectX Registration</string>
	<key>postinstall_script</key>
	<string>#!/bin/bash

"/Applications/DetectX Swift.app/Contents/MacOS/DetectX Swift" register -key "XXXXX-XXXXX-XXXXX-XXXXX-XXXXX-XXXXX-XXXXX-XXXXX-XXXXX-XXXXX-XXXXX-XXXXX-XXXXX-XXXXX-XXXX" -email "email@example.com"</string>
	<key>unattended_install</key>
	<false/>
	<key>version</key>
	<string>1.0</string>
</dict>
</plist>

Leave a Reply

Your email address will not be published. Required fields are marked *