Is there a script available to properly re-install management? Im currently trying with the below bash script but it seems to get hung up on 'jamf removeFramework'. If i run it as a single command via terminal it works fine. Our installer is copied to every machine and also works fine if run one command at a time.
#!/bin/sh sudo /usr/sbin/jamf removeFramework cd /Library/ClientEng/security/installers/Casper sudo installer -pkg QuickAdd.pkg -target / networksetup -setairportpower airport on exit 0
Well, if you're running your entire script from a Jamf Pro policy, then the first line is essentially telling it to remove itself, which would be why it's hanging up. There's no way for the script to continue to run after the jamf binary was just removed, since the jamf binary is what's running it to begin with.
You'd need to come up with some other method of kicking off the installation of the package, like creating a LaunchDaemon and script that would get triggered after the jamf binary is removed, so it's completely independent of the main script.
But the bigger question is, what exactly are you attempting to solve with the above? I sense there's some larger issue you haven't explained that caused you to go down this direction. Maybe there's a better solution than ripping out the framework and re-installing it.
We have a few configuration profiles and every now and then a machine will have issues re-authenticating to our network for whatever reason. So reinstalling management does the trick since it removes all profiles and adds them back in.
I wrote a script a while back for running a post-OS upgrade inventory, which deployed a LaunchDaemon and script to kick off the inventory using the
jamf binary. You may be able to adapt it to your needs. It's available via the link below: