Don't know about enrollment keys but uploading students would create the groups for you. You'd need to upload a student for each group for each course but that would be easily created in a csvfile. Could be bogus students.
EDIT: just a thought, once the groups were created it would be easy to set the enrollment key from the database itself.