Overview#
We created a template LDIF file for your usage. (see attached
Execution#
You may wish to edit the values in the LDIF
Then from a command-line, the following line should replace all entries in the LDIF file with value COMPUTERNAME with the TEST variable and save to a new ldif file. (We tested this on Linux using BASH)
Either set a variable or use $HOSTNAME (Which normally would be the "hostname -s" value)
TEST=ANEWHOST
Then execute:
sed 's/COMPUTERNAME/$TEST/' computer-account.ldif > $TEST.ldif
Add Computer#
Then, to add the entry:ldapadd -x -H ldap://adldap.YOURDOMAIN.net/ -D "CN=USERONE,OU=Sales,OU=Accounts,DC=YOURDOMAIN,DC=NET" -W -f $TEST.ldif
you should get a response like:
adding new entry "CN=ANEWHOST,OU=AIX,OU=Servers,DC=YOURDOMAIN,DC=NET"
List Computer(s)#
To check the entries in the OU=AIX container, use: (it may take a moment or two to show up)ldapsearch -x -H ldap://adldap.YOURDOMAIN.net/ -b "OU=AIX,OU=Servers,DC=YOURDOMAIN,DC=NET" -D "CN=USERONE,OU=Sales,OU=Accounts,DC=YOURDOMAIN,DC=NET" -W -LLL 1.1
It will list the names like:
dn: OU=AIX,OU=Servers,DC=YOURDOMAIN,DC=NET dn: CN=APC16S240b,OU=AIX,OU=Servers,DC=YOURDOMAIN,DC=NET dn: CN=ANEWHOST,OU=AIX,OU=Servers,DC=YOURDOMAIN,DC=NET
Delete Computer#
To delete an entry in the container (Change the values for "CN=ANEWHOST,OU=AIX,OU=Servers,DC=YOURDOMAIN,DC=NET") and execute:ldapdelete -x -H ldap://adldap.YOURDOMAIN.net/ -D "CN=USERONE,OU=Sales,OU=Accounts,DC=YOURDOMAIN,DC=NET" -W "CN=ANEWHOST,OU=AIX,OU=Servers,DC=YOURDOMAIN,DC=NET"
As the ldap utilities syntax varies from one host and version to another, these may need tweaking a bit.