Script to fix Management Commands in Pending state - what is the script actually doing?

TheCrusher4Real
New Contributor III

Trying to get an understanding of what some scripts do that were written by a previous Jamf admin. We have a device in our fleet that keeps racking up Pending management commands. The MacBook in question is up to date in terms of OS and software updates, but it never seems to process any management commands. I tried clearing them then sending a blank push, but that didn't do anything.

A bit of online searching uncovered the recommendation to run the following command:

sudo profiles renew -type enrollment

I ran that on one of my test devices (actually ran it from Self Service because the script is a payload to a Policy) and am trying to understand what the script actually does, or how I can tell that it ran successfully.

I can see in jamf.log where the script began to execute, but there's no other info in jamf.log or install.log.

I checked the system logs by running the following Terminal command:

log show --predicate 'process == "mdmclient"' --info

That returned a ton of information, and I can see events happening shortly after when I fired off the script, but I don't know exactly what I'm looking for to tell me that the script is running, or that it finished, or that it actually worked.

2 REPLIES 2

TheCrusher4Real
New Contributor III

Answering part of my own question: I can check the Policy logs to tell that the status is "Completed" on the device in question.

But I'd still like to know what exactly the script is doing. Thanks!

AJPinto
Esteemed Contributor

Seems like this is two difference situations.

 

  • Scripts - They are deployed by policies from Jamf and run using the Jamf Binary. Scripts will cache in the Jamf directory on the device before they run, and there won't be much for logging beyond seeing the script happened unless whoever wrote the script deliberately put logging in the script. 
  • Scripts: Previous Admins left overs - You will need to review the scripts the previous admin wrote to know what they do. Honestly if you are recently taken over an environment I strongly suggest you spend a lot of time reading everything that was configured and seeing how everything ties together.