Bulk automate modify computers in LDAP



I have a text file which I could convert into any format, I choose CSV as per similar discussion in: Bulk add / import / enroll users
In text files I have computer name, IP address, MAC address
All those computers exist in LDAP but without IP address and MAC
I would like to import that into LDAP with, possibly, udm. I tried command manually to insert at least 1 computer and I get errors, could someone please help me create the correct command? Thanks. I tried:

udm computers/windows modify --dn=cn=PC2 --set macAddress=00:11:22:33:44:55 
Warning: No attribute with name 'macAddress' in this module, value not set.
Modify computers/computer not allowed

udm computers/computer modify --dn cn=PC2 --set macAddress=00:11:22:33:44:55 
Warning: No attribute with name 'macAddress' in this module, value not set.
E: object not found

I tried various options, modify, --set, --append --dn=cn=PC2
No luck.



your DN is wrong, it must be the fully-qualified DN, not the relative one, e.g. …--dn cn=member,cn=memberserver,cn=computers,dc=mbu-test,dc=intranet

You can find out the DN to modify via univention-ldapsearch cn=PC2 dn

Kind regards,


Furthermore, you need to specify --set mac=, since udm does not use the attribute name as the variable name here.



that’s correct, of course. You can see the attribute names that the udm accepts and knows via udm computers/windows help

Kind regards,


I was able to add IP and MAC using computers/ipmanagedclient:

udm computers/ipmanagedclient modify --cn=cn=pc3,cn=computers,dc=roman,dc=com --set mac=00:11:22:33:44:55
udm computers/ipmanagedclient modify --cn=cn=pc3,cn=computers,dc=roman,dc=com --set ip=

but I cannot set network, dhcpEntryZone (service)

Invalid syntax: dhcpEntryZone: Not a valid DLAP DN

udm computers/ipmanagedclient modify --cn=cn=pc3,cn=computers,dc=roman,dc=com --set dhcpEntryZone="cn=roman.com,cn=dhcp,dc=roman,dc=com"
I get error:

Invalid syntax: dhcpEntryZone: This is not a valid MAC address (valid examples are 86:f5:d1:f5:6b:3e, 86-f5-d1-f5-6b-3e, 86f5d1f56b3e, 86f5.d1f5.6b3e)
(my DHCP service is named roman.com)

and even with that I am not sure whether DHCP options will pick up MAC address automatically? And DNS settings?

I thought I would try one liner and still get dhcpEntryZone error.
udm computers/ipmanagedclient modify --cn=cn=pc3,cn=computers,dc=roman,dc=com --set mac=00:11:22:33:44:55 --set dhcpEntryZone="cn=roman.com,cn=dhcp,dc=roman,dc=com" --set network="default"



the argument for dhcpEntryZone must have the format zoneDN IPaddress MACaddress, e.g.:

udm … --set "dhcpEntryZone=cn=bs.linet-services.de,cn=dhcp,dc=… 00:11:22:33:44:55"

Kind regards,


Okay great, I have managed to add DHCP and IP/MAC, however I still have to add network and DNS settings.

Progress so far:
ucsbase=$(get ucr ldap/base)
udm computers/ipmanagedclient modify --dn=cn=PC2,cn=computers,$ucsbase --set "dhcpEntryZone=cn=roman.com,cn=dhcp,$ucsbase 00:11:22:33:44:55" --set mac=00:11:22:33:44:55 --set ip=



when in doubt, I suggest you edit one object via the web-based management console. Then search for that object with udm, and it’ll output the settings the way it recognizes them. That’ll show you how to set up forward/reverse DNS zone entries.

Kind regards,


Thanks Moritz that gives me the output. However I cannot feed same options into udm.

I think there is a better way to achieve what I need
to use dhcp/host and dns/host_record

UDM dhcp/host does not work for me. If I need to modify existing object, then I need to provide DN.

ucsbase=$(ucr get ldap/base)
udm dhcp/host list
DN: cn=WIN10-1,cn=roman.com,cn=dhcp,dc=roman,dc=com
<…fixedaddress host and hwaddress not copied here…>

udm dchp/host modify --dn=cn=PC2,cn=roman.com,cn=dhcp,$ucsbase --superordinate “cn=roman.com,cn=dhcp,$ucsbase” --set host="{C2{ --set fixedaddress=“” --set hwaddress=“ethernet 00:11:22:33:44:55”
E: object not found

udm dchp/host modify --dn=cn=PC2,cn=computers,$ucsbase --superordinate “cn=roman.com,cn=dhcp,$ucsbase” --set host="{C2{ --set fixedaddress=“” --set hwaddress=“ethernet 00:11:22:33:44:55”
Information provided is not sufficient: No superordinate object given



hmm, you should only have to modify a computers/ipmanagementclient object and set its dnsEntryZoneForward, dnsEntryZoneReverse and dhcpEntryZone properties. The corresponding dhcp/host, dns/host_record and dns/ptr_record objects should be created or updated automatically for you.

Of course you can create the DHCP and DNS objects manually, but then you have to verify whether or not they exist and call udm … create --superordinate=… … if they do and udm … create --dn=… … if they don’t. BTW, you only need to specify --superordinate when creating entries, not when you modify them as the DN already contains the information where the object to modify is located.

Kind regards,


Thanks to:
udm computers/windows list
udm dhcp/host list
I was able to understand which settings to pass into udm. Above command was almost complete, the missing option was the network which then pre-configures DNS for me. So the final command would look like:

ucsbase=$(ucr get ldap/base)
udm computers/ipmanagedclient modify --dn=cn=PC2,cn=computers,$ucsbase --set "dhcpEntryZone=cn=roman.com,cn=dhcp,$ucsbase 00:11:22:33:44:55" --set mac=00:11:22:33:44:55 --set ip= --set network=cn=default,cn=networks,$ucsbase

network=cn=default, default is the name I gave to one of the networks.
dhcpEntryZone=cn=roman.com, roman.com is the name of the DHCP service in my UCS Lab.
–dn=cn=PC2, PC2 is the name of the computer/host.