I don't think Moodle 2 supports this, at least not upon user login the way 1.9 does. In 2.x, it seems the only way is by running enrol/db/sync.php from the command-line. This works, but for me it's kind of annoying since it creates EVERY course. I have an organization with 30000+ students and 1500+ teachers, comprising 4500+ courses. But only about 5% of them are ever used inside Moodle. It doesn't make much sense to clutter the database with EVERY possible course and enrollment, when only a handful of them will actually be used.