Oh no, I’m too late, it would have been much simpler:
Show deleted users (just marked as deleted)
occ ldap:show-remnants
You get a table listing the remnants:
+--------------------------------------+----------------------------------------------------+---------------+-----------------------------------------------------------+-------------------+-------------------+-----+--------+
| Nextcloud name | Display Name | LDAP UID | LDAP DN | Last Login | Detected on | Dir | Sharer |
+--------------------------------------+----------------------------------------------------+---------------+-----------------------------------------------------------+-------------------+-------------------+-----+--------+
| 2B4F13C2-7F2F-4A5C-AB58-8EFDABE4BA44 | ncuser1 (ncuser1) | ncuser1 | cn=ncuser1,cn=users,dc=ad,dc=mrmarkuz,dc=test,dc=tld | February 10, 2022 | February 10, 2022 | | N |
Delete User by “Nextcloud Name”:
occ user:delete 2B4F13C2-7F2F-4A5C-AB58-8EFDABE4BA44
See Nextcloud docs.