Skip to main content
Question

Python Script for Defender Onboarding- Help Please


Forum|alt.badge.img+5

Since Apple depreciated Python 2 from all systems starting with 12.3 I cannot get any machine to onboard with our script. I installed python 3 and modified the script to point to that location. I get failed via Jamf and invalid syntax when dropping the script file in terminal after starting python. Below os the top part of the script.

 

#!/usr/local/bin/env python3

import sys, getopt, os, errno, json, plistlib, subprocess, tempfile

config_xml = '''<?xml version=\\"1.0\\" encoding=\\"utf-8\\"?>
<!DOCTYPE plist PUBLIC \\"-//Apple//DTD PLIST 1.0//EN\\" \\"http://www.apple.com/DTDs/PropertyList-1.0.dtd\\">
<plist version=\\"1\\">
<dict>

 

Before the top line was #!/usr/bin/env python

 

Any Help is greatly appreciated 

3 replies

Forum|alt.badge.img+5
  • Author
  • Contributor
  • 30 replies
  • May 17, 2022

I may not need the help. Just got a new onboarding file from my InfoSec dept and they changed from a .py to a .sh good old regular shell script


Forum|alt.badge.img+10
  • Valued Contributor
  • 111 replies
  • May 18, 2022

You should also be able to pull the onboarding code for an MDM profile out of your Defender console. Using the profile instead of a script will ensure that users can't edit/change settings.

 

https://docs.microsoft.com/en-us/microsoft-365/security/defender-endpoint/mac-jamfpro-policies?view=o365-worldwide


Forum|alt.badge.img+5
  • Author
  • Contributor
  • 30 replies
  • May 18, 2022

We have a new onboarding file. They changed it to a shell script finally. 


Reply


Cookie policy

We use cookies to enhance and personalize your experience. If you accept you agree to our full cookie policy. Learn more about our cookies.

 
Cookie settings