See the following for the exact script you need for M1 Macs,
https://community.jamf.com/t5/jamf-pro/macos-installer-script-not-working-for-apple-silicon-m1-macbook/m-p/250873/highlight/true#M233793.
You may need to modify the part of the script that ...
The script you posted also showed the incorrect syntax. Did you verify
that it's -flushcache in your script? I've just used dscacheutil
-flushcachein my script.
In the script you posted earlier, there's a typo. It should be
/usr/bin/dscacheutil -flushcache Your script shows it as
/usr/bin/dscacheutil -flushcach
I've tested it and it does work. I used
https://github.com/laurentpertois/Search-Scripts-In-Jamf/blob/main/searchScriptsAndEAsInJamf.sh
to also find any python reference in EAs.