auto. create users via batch and generate vouchers via scrpt

Hello.

I am looking for a solution for doing following steps via script!

  1. count all available users with a specific profile, if count < 10 then
  2. generate users (like in GUI via batch)
  3. generate vouchers for the new created users and send via email or save on internal storage (like in GUI)

Unfortuanetly i did not found any solution via seach in forum nor google.

thx in advance.

mali2003