This is a turbo-charged version of Restore a LDAP object - use at own risk.
All UCS systems with an OpenLDAP server dump the contents of the local LDAP directory via slapcat every night to /var/univention-backup/ldap-backup_<DATE>.ldif.gz. As you can tell by the filename, these dumps also get compressed via gzip.
To extract a single object from the dump, you can use this snippet (just replace the DN of the object you want to restore and the date of the backup file):
zcat /var/univention-backup/ldap-backup_20200730.ldif.gz | ldapsearch-wrapper | \
sed -ne '/^dn: uid=michael,cn=users,dc=example,dc=org$/,/^$/p' | \
egrep -v '^(structuralObjectClass|entryCSN): ' > michael.ldif
We can then proceed and add this ldif to the LDAP directory:
ldapadd -D cn=admin,$(ucr get ldap/base) -w "$(cat /etc/ldap.secret)" -f michael.ldif -e relax
Please make sure you don’t restore an object with unique identifiers that have been assigned again in the meanwhile to other objects (uidNumber, gidNumber, sambaSID …). See Restore a LDAP object for details on SIDs.
Please also check for e.g. missing group memberships.