shbedev / jamf-recovery-lock

Python script to set Recovery Lock key for Apple M1 computers.
23 stars 5 forks source link

Editing main.py and filtering for 1 computer #4

Closed zroked closed 9 months ago

zroked commented 1 year ago

In the readme it says " Test the script by editing main.py and filtering for 1 computer, before running this on all computers"

I don't know much about python script but from what I understand I believe I need to make a change on the following line.

computers_id = get_arm64('filter=general.name=="jdoe-mbp"') # remove filter argument to get all computers

Would I just need to change 'jdoe-mbp' to one of our computer names? Also is there any other change I need to make just to test on one machine? When I want to run the change for all machines do I just remove ('filter=general.name=="jdoe-mbp"')?

Maybe the readme could be updated with this info

Thanks Zubair

joshnovotny commented 1 year ago

@zroked I figured this out on my own.

Yes, you just change the computer name to the computer name of the one you are testing.

For running it on all computers, you change that line to:

computers_id = get_arm64(get_arm64)

I also found that the instance_id doesn't work unless I delete the https:// from the front of my Jamf URL.

I would agree the ReadMe needs work.

zroked commented 1 year ago

@joshnovotny thank you very much for the reply. Tested it and it works perfectly.

I also found through a lot failed changes that if you

import socket name = socket.gethostname()

Then for computers_id computers_id = get_arm64('filter=general.name=="'+name+'"')

Then you can run the script for just the one machine the policy is running on.

Thanks

shbedev commented 9 months ago

Thank you all for your feedback. I have updated the readme and comments to make it more clear and also removed the https:// prefix from the instanceId comment in the auth/creds.py file like suggested. I no longer have access to a Jamf server so can't really test it. If you find any issue, feel free to let me know and I will fix it.