jamf / ReEnroller

Migrate macOS devices from one Jamf Server to another.
MIT License
104 stars 11 forks source link

Error with the apiMDM remove script... #3

Closed GabeShack closed 4 years ago

GabeShack commented 4 years ago

Just curious if this api call script would work in a policy with a normal quick add package or if I have to use it along side the ReEnroller? (IE are the policy screenshots in the help file showing the trigger that is specific to what the ReEnroller calls?) Gabe Shackney Princeton Public Schools

GabeShack commented 4 years ago

NM, saw the answer in another closed issue. Thanks!

GabeShack commented 4 years ago

Im running the apiMDM, remove policy and im getting the following return doesnt seem to be working to call the api to remove the mdm. Executing Policy apiMDM_remove

Running script RemoveMDM.bash... Script exit code: 0 Script result: mismatched tag at line 10, column 2, byte 404:

You can get technical details here.
Please continue your visit at our home page.

=^at /System/Library/Perl/Extras/5.18/darwin-thread-multi-2level/XML/Parser.pm line 187.Status page

Unauthorized

The request requires user authentication

You can get technical details here.
Please continue your visit at our home page.

GabeShack commented 4 years ago

If I run the command directed after obtaining all the variables: <?xml version="1.0" encoding="UTF-8"?>UnmanageDeviced2098c46-677f-42c8-ae98-44de8c952d784937HS-Tech-25300 This is what the command returns.

GabeShack commented 4 years ago

I stripped out everything but just the variables and the 3 lines of code and the issue I get is: Executing Policy apiMDM_remove Running script apiMDM_remove.sh... Script exit code: 6 Script result: no element found at line 1, column 0, byte 0:

Error running script: return code was 6.

BIG-RAT commented 4 years ago

The 'no element found at line 1...' to me sounds like an error generated from xpath.

The 'Unauthorized' mentioned a few posts up may be a result of incorrect permissions on the account used to make the API call.

I get the following in the policy log:

Script result: computer UUID: 564A4892-06E3-2F15-284E-1E8DE931EE6B
Found 1 nodes:
-- NODE --

computer ID: 529
unmanage machine: curl -X POST -sku mdmRemover:******** https://your.jamfcloud.com/JSSResource/computercommands/command/UnmanageDevice/id/529
<?xml version="1.0" encoding="UTF-8"?><computer_command><command><name>UnmanageDevice</name><command_uuid>3cec7ff8-42e9-4b14-a2e3-418a420168da</command_uuid><computer_id>529</computer_id></command></computer_command>
GabeShack commented 4 years ago

Yea I figured out the authorized issue now just can’t get it to perform the command without typing it all out manually so I’m not sure where the error is. I’ll explore the xpath. Perhaps there is just a space somewhere it shouldn’t be.

GabeShack commented 4 years ago

Im a giant moron and with our migration didn't realize I was only editing the script variable "descriptions" and not the actual script variables since I had never used scripts directly from the JSS previously. So sorry to waste all your time with this.

Gabe