Skip to content
Open

Dev #22

Show file tree
Hide file tree
Changes from 9 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
# History

- 2026-09-05: Better error handling, Address issues running profiles show command as the logged in user.

- 2026-01-31: Minor code cleanup. Update help. Add telemetry deck integration.

- 2025-11-15: Fix MDM removal script (issue #21) along with a typo for macOS minor version.
Expand Down
4 changes: 2 additions & 2 deletions ReEnroller.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -412,7 +412,7 @@
"@executable_path/../Frameworks",
);
MACOSX_DEPLOYMENT_TARGET = 10.15;
MARKETING_VERSION = 5.9.0;
MARKETING_VERSION = 5.9.1;
PRODUCT_BUNDLE_IDENTIFIER = com.jamf.pse.ReEnroller;
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_VERSION = 5.0;
Expand Down Expand Up @@ -440,7 +440,7 @@
"@executable_path/../Frameworks",
);
MACOSX_DEPLOYMENT_TARGET = 10.15;
MARKETING_VERSION = 5.9.0;
MARKETING_VERSION = 5.9.1;
PRODUCT_BUNDLE_IDENTIFIER = com.jamf.pse.ReEnroller;
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_VERSION = 5.0;
Expand Down
2 changes: 1 addition & 1 deletion ReEnroller/Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
<key>CFBundleShortVersionString</key>
<string>$(MARKETING_VERSION)</string>
<key>CFBundleVersion</key>
<string>20260201.012954</string>
<string>20260905.132519</string>
<key>LSApplicationCategoryType</key>
<string>public.app-category.utilities</string>
<key>LSMinimumSystemVersion</key>
Expand Down
10 changes: 7 additions & 3 deletions ReEnroller/ViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -648,7 +648,7 @@ class ViewController: NSViewController, URLSessionDelegate {
var binaryExists = false
var binaryDownloaded = false

if retryCount > maxRetries && maxRetries > -1 {
if retryCount >= maxRetries && maxRetries > -1 {
// retry count has been met, stop retrying and remove the app
WriteToLog.shared.message(theMessage: "Retry count: \(retryCount)")
WriteToLog.shared.message(theMessage: "Maximum retries: \(maxRetries)")
Expand Down Expand Up @@ -1265,6 +1265,11 @@ class ViewController: NSViewController, URLSessionDelegate {
// alert the user, we're done
Alert.shared.display(header: "Process Complete", message: "A package (\(packageName)-\(self.shortHostname).pkg) has been created in Downloads which is ready to be deployed with your current Jamf server.\n\nThe package \(self.includesMsg) a postinstall script to load the launch daemon and start the \(packageName) app.\(self.includesMsg2)\(self.policyMsg)")
processQuickAdd_Button.isEnabled = true

WriteToLog.shared.message(theMessage: "[TelemetryDeck] - sending signal - params: \(TelemetryDeckConfig.parameters)")
Task {@MainActor in
TelemetryDeckSignal.shared.send("runComplete", parameters: TelemetryDeckConfig.parameters)
}
}

func connectedToNetwork() -> Bool {
Expand Down Expand Up @@ -2211,7 +2216,7 @@ class ViewController: NSViewController, URLSessionDelegate {
// update inventory - end

// see if device is scoped to a prestage enrollment
_ = Command.shared.myExitCode(cmd: "/bin/launchctl", args: "asuser", "$(id -u \"$(stat -f%Su /dev/console)\")", "/usr/bin/profiles", "show", "-type", "enrollment")
_ = Command.shared.myExitCode(cmd: "/bin/bash", args: "-c", "/bin/launchctl asuser $(id -u \"$(stat -f%Su /dev/console)\") /usr/bin/profiles show -type enrollment")

if callEnrollment == "yes" {
// launch profiles renew -type enrollment to initiate ADE process
Expand Down Expand Up @@ -2613,7 +2618,6 @@ class ViewController: NSViewController, URLSessionDelegate {


TelemetryDeckConfig.optOut = plistData["optOutdaf"] as? Bool ?? false
print("optOutdaf: \(TelemetryDeckConfig.optOut)")

jssUrl_TextField.stringValue = userDefaults.string(forKey: "jamfProUrl") ?? ""
jssUsername_TextField.stringValue = userDefaults.string(forKey: "jamfProUser") ?? ""
Expand Down
6 changes: 5 additions & 1 deletion ReEnroller/help/apiMDM_remove.txt
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@
# - updated 20200918: Updates due to changes in xpath for Big Sur
# - updated 20240726: Update to use token for authentication
# - updated 20251020: Update for Jamf Pro 11.21 (removal of UnmanageDevice from Classic API)
# - updated 20260831: Update for Jamf Pro 11.31 (new remove-mdm-profile endpoint)
#
####################################################################################################

Expand Down Expand Up @@ -164,7 +165,10 @@ jpMajVer=$(echo $version | awk -F. {'print $1'})
jpMinVer=$(echo $version | awk -F. {'print $2'})

## send unmanage command to machine
if [ $jpMajVer -gt 10 ] && [ $jpMinVer -gt 20 ];then
if [ $jpMajVer -gt 10 ] && [ $jpMinVer -gt 30 ];then
echo "unmanage machine: curl -m 20 -s ${server}api/v4/computers-inventory/${compId}/remove-mdm-profile -X POST -H \"Authorization: Bearer $(echo $token | head -n15)...\""
/usr/bin/curl -m 20 -s ${server}api/v4/computers-inventory/${compId}/remove-mdm-profile -X POST -H "Authorization: Bearer $token"
elif [ $jpMajVer -gt 10 ] && [ $jpMinVer -gt 20 ];then
echo "unmanage machine: curl -m 20 -s ${server}api/v1/computer-inventory/${compId}/remove-mdm-profile -X POST -H \"Authorization: Bearer $(echo $token | head -n15)...\""
/usr/bin/curl -m 20 -s ${server}api/v1/computer-inventory/${compId}/remove-mdm-profile -X POST -H "Authorization: Bearer $token"
else
Expand Down
6 changes: 5 additions & 1 deletion ReEnroller/help/help.html
Original file line number Diff line number Diff line change
Expand Up @@ -334,6 +334,7 @@ <h1>ReEnroller</h1>
# - updated 20200918: Updates due to changes in xpath for Big Sur
# - updated 20240726: Update to use token for authentication
# - updated 20251020: Update for Jamf Pro 11.21 (removal of UnmanageDevice from Classic API)
# - updated 20260831: Update for Jamf Pro 11.31 (new remove-mdm-profile endpoint)
#
####################################################################################################

Expand Down Expand Up @@ -441,7 +442,10 @@ <h1>ReEnroller</h1>
jpMinVer=$(echo $version | awk -F. {'print $2'})

## send unmanage command to machine
if [ $jpMajVer -gt 10 ] && [ $jpMinVer -gt 20 ];then
if [ $jpMajVer -gt 10 ] && [ $jpMinVer -gt 30 ];then
echo "unmanage machine: curl -m 20 -s ${server}api/v4/computers-inventory/${compId}/remove-mdm-profile -X POST -H \"Authorization: Bearer $(echo $token | head -n15)...\""
/usr/bin/curl -m 20 -s ${server}api/v4/computers-inventory/${compId}/remove-mdm-profile -X POST -H "Authorization: Bearer $token"
elif [ $jpMajVer -gt 10 ] && [ $jpMinVer -gt 20 ];then
echo "unmanage machine: curl -m 20 -s ${server}api/v1/computer-inventory/${compId}/remove-mdm-profile -X POST -H \"Authorization: Bearer $(echo $token | head -n15)...\""
/usr/bin/curl -m 20 -s ${server}api/v1/computer-inventory/${compId}/remove-mdm-profile -X POST -H "Authorization: Bearer $token"
else
Expand Down
Loading