brodjieski / macos

12 stars 0 forks source link

KeyError: 'Forced' #2

Open grahampugh opened 1 month ago

grahampugh commented 1 month ago

Hi there, not sure how to diagnose this, but I'm getting an error running this on a macOS 14.6.1 client running with the latest Xcode CLI Tools installed:

sudo python3 profile_parse.py 
Password:
Traceback (most recent call last):
  File "/Users/_test/Downloads/macos-main/profile_parse/profile_parse.py", line 97, in <module>
    main() 
  File "/Users/_test/Downloads/macos-main/profile_parse/profile_parse.py", line 59, in main
    for mcx in items["PayloadContent"]['PayloadContentManagedPreferences'][k]['Forced']:
KeyError: 'Forced'

I get the same error if I use mukti-python to run it (Both are python 3.9.6 I believe).

brodjieski commented 1 month ago

Hello! When the script is processing profiles that are set with the MCX-type values, it is looking for keys that are "forced". If the profile doesn't have that key, it's throwing that error.

I made an adjustment to the script to try and report which profile is causing the problem... please try it again and see if that helps.