This script will create a user and optionally add it to a group:
https://github.com/pfaffman/discourse-user-creator