by Ken Task.
Not an answer ... yet ... but question ...
"Every year before the semester starts course admins use the backup-restore-copy functionalities to create a new version of the same course"
Is there any reason those courses could not be reset - removing role ID 5 (which is student) via looping moosh script?
'SoS', Ken