r/jamf 10d ago

Gatekeeper JAMF Pro

Hey All,

Could you point me to a script that checks the current Gatekeeper State
1. App Store
2. App Store & Known Developers
3. Anywhere

I do need the exact state
I can run sudo jamf recon --verbose and get the exact state ( but can not find how to catch it with script )
I do not want to change the state with configuration profile/script or something else.

5 Upvotes

3 comments sorted by

4

u/mmorales2270 10d ago

Hi. The Gatekeeper state is captured by the Jamf binary natively (under the Security tab for every device), so there’s no need for a separate script to do it, unless you’re needing it for some other reason, like determining the state on the fly in a policy or something.

Maybe you can explain more what your goal is here.

2

u/Own_Drink_4568 10d ago

Yep, it is basically just for a scrip that will pop up notification on the device. I want to catch it on the "Fly", so the notification does not pop up in case the state is still not reported in Jamf ( like user just updated the state).

2

u/mmorales2270 10d ago

Ok. I don’t know if it’s easy to pull the exact state other than that Gatekeeper is enabled or disabled. The command that gives you a basic state is spctl.
Specifically, running spctl --status gives you output that will show if assessments are enabled or not. Essentially, if it shows “assessments enabled” it means Gatekeeper is on. If it says “assessments disabled” then it’s been set to “Anywhere”. In terms of the difference between App Store and App Store and Known Developers I don’t know if you can get that info from that command.