Are you connecting via the localhost interface? After enabling authentication, if no users exist on the system, the only way to connect and create users is to connect via localhost. So you would ssh to the server hosting the MongoDB instance and run the script from there.
If you are already doing that and you still can't get in, I would guess that there might be an existing user already on the database. In that case, the localhost exception closes. In this case, you would need to disable auth, create userAdmin@admin, and re-enable auth.
Worst case scenario you can disable auth, create userAdmin@admin, and re-enable auth. But I would try to execute the script on the machine hosting the MongoDB server first, and if that fails, do the disable-enable route. If you do have to disable auth, I'd use something like db.getUsers() for each DB to see if maybe there is a user hanging around that messed everything up.