C'è un modo per aggiungere in modo programmatico ai gruppi?

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