Skip to content

Instantly share code, notes, and snippets.

@bryanheinz
Last active December 14, 2020 22:33
Show Gist options
  • Save bryanheinz/33b6a29888a6a62973700ea68cd67781 to your computer and use it in GitHub Desktop.
Save bryanheinz/33b6a29888a6a62973700ea68cd67781 to your computer and use it in GitHub Desktop.
#
# get all .mobileconfig profiles and add them to SimpleMDM as custom profiles
# using Lucas' fork of simpleMDMpy https://github.com/lucasjhall/simpleMDMpy
# dropped the SimpleMDMpy folder into /usr/local/lib/python3.9/site-packages/ (or whatever your Python 3 path is)
#
api_key = ''
mdm_dir = pathlib.Path('/Users/bryanh/Documents/dev/profiles/mdm/')
tcc_dir = mdm_dir / 'tcc'
mdm_files = list(mdm_dir.glob('*.mobileconfig'))
tcc_files = list(tcc_dir.glob('*.mobileconfig'))
profiles = mdm_files + tcc_files
results = []
for fp in profiles:
name = fp.stem
r = SimpleMDMpy.CustomConfigurationProfiles(api_key).create_profile(
name, fp, user_scope='false'
)
if r.status_code != 201:
print(name)
print(fp)
pprint(r.json())
print("\n*\n")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment