¿Alguna forma de agregar a grupos programáticamente?

Yes, that’s Plan B, but possibly with LDAP groups…